Skip to content

Commit a5a991f

Browse files
committed
check that their are processes to start
1 parent e8a84b4 commit a5a991f

File tree

1 file changed

+15
-11
lines changed

1 file changed

+15
-11
lines changed

src/PatternLab/Console/ProcessSpawner.php

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -60,21 +60,25 @@ public function spawn($commands = array(), $quiet = false) {
6060
$processes[] = $this->buildProcess($pluginProcess);
6161
}
6262

63-
// start the processes
64-
foreach ($processes as $process) {
65-
$process["process"]->start();
66-
}
67-
68-
// now monitor and output as appropriate
69-
while (true) {
63+
// if there are processes to spawn do so
64+
if (!empty($processes)) {
65+
66+
// start the processes
7067
foreach ($processes as $process) {
71-
if ($process["process"]->isRunning()) {
72-
if (!$quiet && $process["output"]) {
73-
print $process["process"]->getIncrementalOutput();
68+
$process["process"]->start();
69+
}
70+
71+
// check on them and produce output
72+
while (true) {
73+
foreach ($processes as $process) {
74+
if ($process["process"]->isRunning()) {
75+
if (!$quiet && $process["output"]) {
76+
print $process["process"]->getIncrementalOutput();
77+
}
7478
}
7579
}
80+
usleep(100000);
7681
}
77-
usleep(100000);
7882
}
7983

8084
}

0 commit comments

Comments
 (0)