diff options
author | Alex Lam S.L <alexlamsl@gmail.com> | 2018-01-15 23:41:39 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-01-15 23:41:39 +0800 |
commit | ec7cd1dcf7c7a3b86288061b61ad72ba081f83bb (patch) | |
tree | 7f57fcffb3ab454cdaa02a701691edcb42f89d10 /test | |
parent | 7def684730ad3a684e64963961f3b33b308fd95d (diff) | |
download | tracifyjs-ec7cd1dcf7c7a3b86288061b61ad72ba081f83bb.tar.gz tracifyjs-ec7cd1dcf7c7a3b86288061b61ad72ba081f83bb.zip |
handle VM failure gracefully (#2791)
Diffstat (limited to 'test')
-rw-r--r-- | test/travis-ufuzz.js | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/test/travis-ufuzz.js b/test/travis-ufuzz.js index 8685732f..579b7448 100644 --- a/test/travis-ufuzz.js +++ b/test/travis-ufuzz.js @@ -42,21 +42,26 @@ if (process.argv.length > 2) { "test/ufuzz" ], { stdio: [ "ignore", "pipe", "pipe" ] + }).on("exit", function() { + console.log(line); + clearInterval(keepAlive); + clearTimeout(timer); }); var line = ""; child.stdout.on("data", function(data) { line += data; }); child.stderr.on("data", function() { - process.exitCode = (process.exitCode || 0) + 1; + process.exitCode = 1; }).pipe(process.stdout); var keepAlive = setInterval(function() { var end = line.lastIndexOf("\r"); console.log(line.slice(line.lastIndexOf("\r", end - 1) + 1, end)); line = line.slice(end + 1); }, ping); - setTimeout(function() { + var timer = setTimeout(function() { clearInterval(keepAlive); + child.removeAllListeners("exit"); child.kill(); }, period); } |