kopia lustrzana https://github.com/c9/core
better way to kill runner process
rodzic
ce6eb41304
commit
585cc8a609
|
@ -2248,9 +2248,9 @@ module.exports = function setup(fsOptions) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function killtree(pid, options, callback) {
|
function killtree(pid, options, callback) {
|
||||||
var code = options.code || "SIGKILL";
|
var code = options.code || options.graceful ? "SIGTERM" : "SIGKILL";
|
||||||
|
|
||||||
childrenOfPid(pid, function(err, pidlist){
|
childrenOfPid(pid, function killList(err, pidlist){
|
||||||
if (err)
|
if (err)
|
||||||
return callback(err);
|
return callback(err);
|
||||||
|
|
||||||
|
@ -2264,10 +2264,19 @@ module.exports = function setup(fsOptions) {
|
||||||
try {
|
try {
|
||||||
process.kill(pid, code);
|
process.kill(pid, code);
|
||||||
} catch(e) {
|
} catch(e) {
|
||||||
// kill may throw if the pid does not exist.
|
if (e.code == "ESRCH")
|
||||||
|
return; // kill may throw if the pid does not exist.
|
||||||
|
// todo try killing with sudo in case of "EPERM"
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
callback(null, {});
|
if (options.graceful && code != "SIGKILL") {
|
||||||
|
code = "SIGKILL";
|
||||||
|
setTimeout(function() {
|
||||||
|
killList(null, pidlist);
|
||||||
|
}, options.timeout || 800);
|
||||||
|
} else {
|
||||||
|
callback(null, {});
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -103,7 +103,7 @@
|
||||||
"c9.ide.recentfiles": "#7c099abf40",
|
"c9.ide.recentfiles": "#7c099abf40",
|
||||||
"c9.ide.remote": "#301d2ab519",
|
"c9.ide.remote": "#301d2ab519",
|
||||||
"c9.ide.processlist": "#bc11818bb5",
|
"c9.ide.processlist": "#bc11818bb5",
|
||||||
"c9.ide.run": "#7fcd6173ba",
|
"c9.ide.run": "#9d632b19c0",
|
||||||
"c9.ide.run.build": "#ad45874c88",
|
"c9.ide.run.build": "#ad45874c88",
|
||||||
"c9.ide.run.debug.xdebug": "#3b1520f83d",
|
"c9.ide.run.debug.xdebug": "#3b1520f83d",
|
||||||
"c9.ide.save": "#a03709ef3f",
|
"c9.ide.save": "#a03709ef3f",
|
||||||
|
|
|
@ -509,6 +509,12 @@ define(function(require, exports, module) {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
/**
|
||||||
|
* @ignore
|
||||||
|
*/
|
||||||
|
killtree: function(pid, options, callback) {
|
||||||
|
vfs.killtree(pid, options, callback);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -410,6 +410,7 @@ define(function(require, exports, module) {
|
||||||
pty: vfsCall.bind(null, "pty"),
|
pty: vfsCall.bind(null, "pty"),
|
||||||
tmux: vfsCall.bind(null, "tmux"),
|
tmux: vfsCall.bind(null, "tmux"),
|
||||||
execFile: vfsCall.bind(null, "execFile"),
|
execFile: vfsCall.bind(null, "execFile"),
|
||||||
|
killtree: vfsCall.bind(null, "killtree"),
|
||||||
|
|
||||||
// Extending the API
|
// Extending the API
|
||||||
use: vfsCall.bind(null, "use"),
|
use: vfsCall.bind(null, "use"),
|
||||||
|
|
Ładowanie…
Reference in New Issue