File tree 2 files changed +20
-2
lines changed
src/Symfony/Component/Process
2 files changed +20
-2
lines changed Original file line number Diff line number Diff line change @@ -774,9 +774,15 @@ public function setTimeout($timeout)
774
774
* @param bool $tty True to enabled and false to disable
775
775
*
776
776
* @return self The current Process instance
777
+ *
778
+ * @throws RuntimeException In case the TTY mode is not supported
777
779
*/
778
780
public function setTty ($ tty )
779
781
{
782
+ if (defined ('PHP_WINDOWS_VERSION_BUILD ' ) && $ tty ) {
783
+ throw new RuntimeException ('TTY mode is not supported on Windows platform. ' );
784
+ }
785
+
780
786
$ this ->tty = (bool ) $ tty ;
781
787
782
788
return $ this ;
Original file line number Diff line number Diff line change @@ -251,7 +251,7 @@ public function testTTYCommand()
251
251
}
252
252
253
253
$ process = $ this ->getProcess ('echo "foo" >> /dev/null && php -r "usleep(100000);" ' );
254
- $ process ->setTTY (true );
254
+ $ process ->setTty (true );
255
255
$ process ->start ();
256
256
$ this ->assertTrue ($ process ->isRunning ());
257
257
$ process ->wait ();
@@ -266,12 +266,24 @@ public function testTTYCommandExitCode()
266
266
}
267
267
268
268
$ process = $ this ->getProcess ('echo "foo" >> /dev/null ' );
269
- $ process ->setTTY (true );
269
+ $ process ->setTty (true );
270
270
$ process ->run ();
271
271
272
272
$ this ->assertTrue ($ process ->isSuccessful ());
273
273
}
274
274
275
+ public function testTTYInWindowsEnvironment ()
276
+ {
277
+ if (!defined ('PHP_WINDOWS_VERSION_BUILD ' )) {
278
+ $ this ->markTestSkipped ('This test is for Windows platform only ' );
279
+ }
280
+
281
+ $ process = $ this ->getProcess ('echo "foo" >> /dev/null ' );
282
+ $ process ->setTty (false );
283
+ $ this ->setExpectedException ('Symfony\Component\Process\Exception\RuntimeException ' , 'TTY mode is not supported on Windows platform. ' );
284
+ $ process ->setTty (true );
285
+ }
286
+
275
287
public function testExitCodeTextIsNullWhenExitCodeIsNull ()
276
288
{
277
289
$ process = $ this ->getProcess ('' );
You can’t perform that action at this time.
0 commit comments