File tree Expand file tree Collapse file tree 2 files changed +22
-0
lines changed
src/Symfony/Component/Process Expand file tree Collapse file tree 2 files changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -557,6 +557,7 @@ public function getIterator($flags = 0)
557
557
yield self ::OUT => '' ;
558
558
}
559
559
560
+ $ this ->checkTimeout ();
560
561
$ this ->readPipesForOutput (__FUNCTION__ , $ blocking );
561
562
}
562
563
}
Original file line number Diff line number Diff line change @@ -747,6 +747,27 @@ public function testRunProcessWithTimeout()
747
747
throw $ e ;
748
748
}
749
749
750
+ /**
751
+ * @expectedException \Symfony\Component\Process\Exception\ProcessTimedOutException
752
+ * @expectedExceptionMessage exceeded the timeout of 0.1 seconds.
753
+ */
754
+ public function testIterateOverProcessWithTimeout ()
755
+ {
756
+ $ process = $ this ->getProcess (self ::$ phpBin .' -r "sleep(30);" ' );
757
+ $ process ->setTimeout (0.1 );
758
+ $ start = microtime (true );
759
+ try {
760
+ $ process ->start ();
761
+ foreach ($ process as $ buffer );
762
+ $ this ->fail ('A RuntimeException should have been raised ' );
763
+ } catch (RuntimeException $ e ) {
764
+ }
765
+
766
+ $ this ->assertLessThan (15 , microtime (true ) - $ start );
767
+
768
+ throw $ e ;
769
+ }
770
+
750
771
public function testCheckTimeoutOnNonStartedProcess ()
751
772
{
752
773
$ process = $ this ->getProcess ('echo foo ' );
You can’t perform that action at this time.
0 commit comments