File tree Expand file tree Collapse file tree 1 file changed +13
-3
lines changed Expand file tree Collapse file tree 1 file changed +13
-3
lines changed Original file line number Diff line number Diff line change @@ -63,18 +63,28 @@ public function spawn($commands = array(), $quiet = false) {
63
63
// if there are processes to spawn do so
64
64
if (!empty ($ processes )) {
65
65
66
+ // get the time out
67
+ $ timeout = Config::getOption ("timeout " ) ? (int )Config::getOption ("timeout " ) : 30 ;
68
+
66
69
// start the processes
67
70
foreach ($ processes as $ process ) {
68
71
$ process ["process " ]->start ();
72
+ $ process ["process " ]->setTimeout ($ timeout );
69
73
}
70
74
71
75
// check on them and produce output
72
76
while (true ) {
73
77
foreach ($ processes as $ process ) {
74
- if ($ process ["process " ]->isRunning ()) {
75
- if (!$ quiet && $ process ["output " ]) {
76
- print $ process ["process " ]->getIncrementalOutput ();
78
+ try {
79
+ if ($ process ["process " ]->isRunning ()) {
80
+ $ process ["process " ]->checkTimeout ();
81
+ if (!$ quiet && $ process ["output " ]) {
82
+ print $ process ["process " ]->getIncrementalOutput ();
83
+ print $ process ["process " ]->getIncrementalErrorOutput ();
84
+ }
77
85
}
86
+ } catch (\RuntimeException $ e ) {
87
+ Console::writeError ("pattern lab processes automatically time out after " .$ timeout ." seconds... " );
78
88
}
79
89
}
80
90
usleep (100000 );
You can’t perform that action at this time.
0 commit comments