From b40fec86bb4064e5893b44e0ae5c8a4ecbf721c4 Mon Sep 17 00:00:00 2001 From: Matt Godbolt Date: Thu, 24 May 2012 08:37:18 -0500 Subject: [PATCH] Possibly fix up orphaned gcc processes; maybe there was a race with the end and the exit() call --- app.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app.js b/app.js index 324ac244..8eb575c9 100755 --- a/app.js +++ b/app.js @@ -104,8 +104,6 @@ function compile(req, res) { var stderr = ""; child.stdout.on('data', function (data) { stdout += data; }); child.stderr.on('data', function (data) { stderr += data; }); - child.stdin.write(source); - child.stdin.end(); child.on('exit', function (code) { child_process.exec('cat "' + outputFilename + '" | c++filt', function(err, filt_stdout, filt_stderr) { var data = filt_stdout; @@ -121,6 +119,8 @@ function compile(req, res) { fs.unlink(outputFilename, function() { fs.rmdir(dirPath); }); }); }); + child.stdin.write(source); + child.stdin.end(); }); }