aboutsummaryrefslogtreecommitdiff
path: root/node_modules/flagged-respawn/lib/respawn.js
diff options
context:
space:
mode:
Diffstat (limited to 'node_modules/flagged-respawn/lib/respawn.js')
-rw-r--r--node_modules/flagged-respawn/lib/respawn.js15
1 files changed, 15 insertions, 0 deletions
diff --git a/node_modules/flagged-respawn/lib/respawn.js b/node_modules/flagged-respawn/lib/respawn.js
new file mode 100644
index 000000000..086585300
--- /dev/null
+++ b/node_modules/flagged-respawn/lib/respawn.js
@@ -0,0 +1,15 @@
+const spawn = require('child_process').spawn;
+
+module.exports = function (argv) {
+ var child = spawn(argv[0], argv.slice(1), { stdio: 'inherit' });
+ child.on('exit', function (code, signal) {
+ process.on('exit', function () {
+ if (signal) {
+ process.kill(process.pid, signal);
+ } else {
+ process.exit(code);
+ }
+ });
+ });
+ return child;
+};