Skip to content

Commit a64cb6e

Browse files
committed
restore COLORTERM in finally
1 parent 156f9d8 commit a64cb6e

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

src/Symfony/Component/Console/Tests/ColorTest.php

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,14 @@ public function testDegradedTrueColors()
4646
$colorterm = getenv('COLORTERM');
4747
putenv('COLORTERM=');
4848

49-
$color = new Color('#f00', '#ff0');
50-
$this->assertSame("\033[31;43m \033[39;49m", $color->apply(' '));
51-
52-
$color = new Color('#c0392b', '#f1c40f');
53-
$this->assertSame("\033[31;43m \033[39;49m", $color->apply(' '));
54-
55-
putenv('COLORTERM='.$colorterm);
49+
try {
50+
$color = new Color('#f00', '#ff0');
51+
$this->assertSame("\033[31;43m \033[39;49m", $color->apply(' '));
52+
53+
$color = new Color('#c0392b', '#f1c40f');
54+
$this->assertSame("\033[31;43m \033[39;49m", $color->apply(' '));
55+
} finally {
56+
putenv('COLORTERM='.$colorterm);
57+
}
5658
}
5759
}

0 commit comments

Comments
 (0)