diff --git a/app.js b/app.js index 8eb575c92..c3785dfaf 100755 --- a/app.js +++ b/app.js @@ -102,9 +102,14 @@ function compile(req, res) { ); var stdout = ""; var stderr = ""; + var timeout = setTimeout(function() { + child.kill(); + stderr += "\nKilled - processing time exceeded"; + }, props.get("gcc-explorer", "compileTimeoutMs", 100)); child.stdout.on('data', function (data) { stdout += data; }); child.stderr.on('data', function (data) { stderr += data; }); child.on('exit', function (code) { + clearTimeout(timeout); child_process.exec('cat "' + outputFilename + '" | c++filt', function(err, filt_stdout, filt_stderr) { var data = filt_stdout; if (err) { diff --git a/etc/config/gcc-explorer.defaults.properties b/etc/config/gcc-explorer.defaults.properties index c42488d5f..55f67d38e 100644 --- a/etc/config/gcc-explorer.defaults.properties +++ b/etc/config/gcc-explorer.defaults.properties @@ -1,2 +1,3 @@ port=10240 +compileTimeoutMs=200 compilers=/usr/bin/g++-4.4:/usr/bin/g++-4.5:/usr/bin/g++-4.6:/usr/bin/arm-linux-gnueabi-g++-4.5