mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-06-03 06:09:02 +02:00
cleanup and comments
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
_ = require("underscore")
|
||||
metrics = require("metrics-sharelatex")
|
||||
logger = require("logger-sharelatex")
|
||||
safe_exec = require('./SafeExec')
|
||||
safe_exec = require("./SafeExec")
|
||||
approvedFormats = ["png"]
|
||||
|
||||
fourtySeconds = 40 * 1000
|
||||
|
||||
@@ -9,6 +9,7 @@ child_process = require('child_process')
|
||||
# group, then we can kill everything in that process group.
|
||||
|
||||
module.exports = (command, options, callback = (err, stdout, stderr) ->) ->
|
||||
# options are {timeout: number-of-milliseconds, killSignal: signal-name}
|
||||
[cmd, args...] = command.split(' ')
|
||||
|
||||
child = child_process.spawn cmd, args, {detached:true}
|
||||
@@ -22,6 +23,7 @@ module.exports = (command, options, callback = (err, stdout, stderr) ->) ->
|
||||
if options.timeout?
|
||||
killTimer = setTimeout () ->
|
||||
try
|
||||
# use negative process id to kill process group
|
||||
process.kill -child.pid, options.killSignal || "SIGTERM"
|
||||
catch error
|
||||
logger.log process: child.pid, kill_error: error, "error killing process"
|
||||
|
||||
Reference in New Issue
Block a user