better way to kill runner process

pull/117/merge
nightwing 2015-06-10 11:40:40 +00:00
rodzic ce6eb41304
commit 585cc8a609
4 zmienionych plików z 22 dodań i 6 usunięć

17
node_modules/vfs-local/localfs.js wygenerowano vendored
Wyświetl plik

@ -2248,9 +2248,9 @@ module.exports = function setup(fsOptions) {
}
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)
return callback(err);
@ -2264,10 +2264,19 @@ module.exports = function setup(fsOptions) {
try {
process.kill(pid, code);
} 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, {});
}
});
}

Wyświetl plik

@ -103,7 +103,7 @@
"c9.ide.recentfiles": "#7c099abf40",
"c9.ide.remote": "#301d2ab519",
"c9.ide.processlist": "#bc11818bb5",
"c9.ide.run": "#7fcd6173ba",
"c9.ide.run": "#9d632b19c0",
"c9.ide.run.build": "#ad45874c88",
"c9.ide.run.debug.xdebug": "#3b1520f83d",
"c9.ide.save": "#a03709ef3f",

Wyświetl plik

@ -509,6 +509,12 @@ define(function(require, exports, module) {
});
});
}
},
/**
* @ignore
*/
killtree: function(pid, options, callback) {
vfs.killtree(pid, options, callback);
}
});

Wyświetl plik

@ -410,6 +410,7 @@ define(function(require, exports, module) {
pty: vfsCall.bind(null, "pty"),
tmux: vfsCall.bind(null, "tmux"),
execFile: vfsCall.bind(null, "execFile"),
killtree: vfsCall.bind(null, "killtree"),
// Extending the API
use: vfsCall.bind(null, "use"),