1919use \PatternLab \Console \ProcessSpawnerEvent ;
2020use \PatternLab \Dispatcher ;
2121use \PatternLab \Timer ;
22+ use \Symfony \Component \Process \Exception \ProcessTimedOutException ;
2223use \Symfony \Component \Process \Process ;
2324
25+
2426class ProcessSpawner {
2527
2628 protected $ pluginProcesses ;
@@ -63,13 +65,9 @@ public function spawn($commands = array(), $quiet = false) {
6365 // if there are processes to spawn do so
6466 if (!empty ($ processes )) {
6567
66- // get the time out
67- $ timeout = Config::getOption ("timeout " ) ? (int )Config::getOption ("timeout " ) : 3600 ;
68-
6968 // start the processes
7069 foreach ($ processes as $ process ) {
7170 $ process ["process " ]->start ();
72- $ process ["process " ]->setTimeout ($ timeout );
7371 }
7472
7573 // check on them and produce output
@@ -83,8 +81,12 @@ public function spawn($commands = array(), $quiet = false) {
8381 print $ process ["process " ]->getIncrementalErrorOutput ();
8482 }
8583 }
86- } catch (\RuntimeException $ e ) {
87- Console::writeError ("pattern lab processes automatically time out after " .$ timeout ." seconds... " );
84+ } catch (ProcessTimedOutException $ e ) {
85+ if ($ e ->isGeneralTimeout ()) {
86+ Console::writeError ("pattern lab processes should never time out. yours did... " );
87+ } else if ($ e ->isIdleTimeout ()) {
88+ Console::writeError ("pattern lab processes automatically time out if their is no command line output in 30 minutes... " );
89+ }
8890 }
8991 }
9092 usleep (100000 );
@@ -110,7 +112,7 @@ protected function buildProcess($commandOptions) {
110112 $ cwd = isset ($ commandOptions ["cwd " ]) ? $ commandOptions ["cwd " ] : null ;
111113 $ env = isset ($ commandOptions ["env " ]) ? $ commandOptions ["env " ] : null ;
112114 $ input = isset ($ commandOptions ["input " ]) ? $ commandOptions ["input " ] : null ;
113- $ timeout = isset ($ commandOptions ["timeout " ]) ? $ commandOptions ["timeout " ] : 60 ;
115+ $ timeout = isset ($ commandOptions ["timeout " ]) ? $ commandOptions ["timeout " ] : null ;
114116 $ options = isset ($ commandOptions ["options " ]) ? $ commandOptions ["options " ] : array ();
115117 $ idle = isset ($ commandOptions ["idle " ]) ? $ commandOptions ["idle " ] : null ;
116118 $ output = isset ($ commandOptions ["output " ]) ? $ commandOptions ["output " ] : true ;
0 commit comments