Skip to content

Commit bdf6313

Browse files
committed
Fix being able to use rs to restart processes
fixes #74
1 parent dc37969 commit bdf6313

File tree

2 files changed

+18
-7
lines changed

2 files changed

+18
-7
lines changed

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,9 @@ EOF
122122

123123
Tests run *perfectly*, ship it to the enterprise!
124124

125+
Once you have the watcher running, you can force restart all tasks by entering `rs`.
126+
If you want to only force a single task, type the name of the key from the watch config (for example `rs test`).
127+
125128
### Options
126129

127130
#### `patterns`

watch-package.js

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,18 +30,26 @@ module.exports = function watchPackage(_pkgDir, exit, taskName) {
3030
// send 'rs' commands to the right proc
3131
stdin = through(function (line, _, callback) {
3232
line = line.toString()
33-
var match = line.match(/^rs\s+(\w+)/)
33+
var match = line.match(/^rs\s*(.*)/)
3434
if (!match) {
3535
console.log('Unrecognized input:', line)
3636
return callback()
3737
}
38-
var proc = processes[match[1]]
39-
if (!proc) {
40-
console.log('Couldn\'t find process:', match[1])
41-
return callback()
38+
39+
if (match[1]) {
40+
var proc = processes[match[1]]
41+
if (!proc) {
42+
console.log('Couldn\'t find process:', match[1])
43+
return callback()
44+
}
45+
proc.stdin.write('rs\r\n')
46+
return callback();
47+
} else {
48+
Object.keys(processes).forEach(function (key) {
49+
processes[key].stdin.write('rs\r\n')
50+
})
51+
callback()
4252
}
43-
proc.stdin.write('rs\n')
44-
callback()
4553
})
4654

4755
stdin.stderr = through()

0 commit comments

Comments
 (0)