handle VM failure gracefully (#2791)
This commit is contained in:
@@ -42,21 +42,26 @@ if (process.argv.length > 2) {
|
|||||||
"test/ufuzz"
|
"test/ufuzz"
|
||||||
], {
|
], {
|
||||||
stdio: [ "ignore", "pipe", "pipe" ]
|
stdio: [ "ignore", "pipe", "pipe" ]
|
||||||
|
}).on("exit", function() {
|
||||||
|
console.log(line);
|
||||||
|
clearInterval(keepAlive);
|
||||||
|
clearTimeout(timer);
|
||||||
});
|
});
|
||||||
var line = "";
|
var line = "";
|
||||||
child.stdout.on("data", function(data) {
|
child.stdout.on("data", function(data) {
|
||||||
line += data;
|
line += data;
|
||||||
});
|
});
|
||||||
child.stderr.on("data", function() {
|
child.stderr.on("data", function() {
|
||||||
process.exitCode = (process.exitCode || 0) + 1;
|
process.exitCode = 1;
|
||||||
}).pipe(process.stdout);
|
}).pipe(process.stdout);
|
||||||
var keepAlive = setInterval(function() {
|
var keepAlive = setInterval(function() {
|
||||||
var end = line.lastIndexOf("\r");
|
var end = line.lastIndexOf("\r");
|
||||||
console.log(line.slice(line.lastIndexOf("\r", end - 1) + 1, end));
|
console.log(line.slice(line.lastIndexOf("\r", end - 1) + 1, end));
|
||||||
line = line.slice(end + 1);
|
line = line.slice(end + 1);
|
||||||
}, ping);
|
}, ping);
|
||||||
setTimeout(function() {
|
var timer = setTimeout(function() {
|
||||||
clearInterval(keepAlive);
|
clearInterval(keepAlive);
|
||||||
|
child.removeAllListeners("exit");
|
||||||
child.kill();
|
child.kill();
|
||||||
}, period);
|
}, period);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user