Skip to content

Commit c927a56

Browse files
committed
forcing watch to start a sub process
1 parent a5a991f commit c927a56

File tree

1 file changed

+23
-11
lines changed

1 file changed

+23
-11
lines changed

src/PatternLab/Console/Commands/WatchCommand.php

Lines changed: 23 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -51,20 +51,32 @@ public function run() {
5151

5252
} else {
5353

54-
// collect any processes that might be related to watch (e.g. reload). spawn them.
55-
if (!Console::findCommandOption("no-procs")) {
54+
if (Console::findCommandOption("no-procs")) {
55+
56+
// don't have to worry about loading processes so launch watcher
57+
58+
// load the generator
59+
$g = new Generator();
60+
$g->generate($options);
61+
62+
// load the watcher
63+
$w = new Watcher();
64+
$w->watch($options);
65+
66+
} else {
67+
68+
// a vanilla --watch command needs to have a --no-procs version built
69+
// so we don't get caught in while() loops. re-request the console command
70+
$commands = array();
71+
$commands[] = array("command" => $this->build()." --no-procs", "timeout" => null, "idle" => 600);
72+
73+
Console::writeInfo("spawning the watch process...");
74+
5675
$process = new ProcessSpawner;
57-
$process->spawn();
76+
$process->spawn($commands);
77+
5878
}
5979

60-
// load the generator
61-
$g = new Generator();
62-
$g->generate($options);
63-
64-
// load the watcher
65-
$w = new Watcher();
66-
$w->watch($options);
67-
6880
}
6981

7082
}

0 commit comments

Comments
 (0)