Reputation: 504
When I execute a command in terminal it lasts ~5s, but when I use require('child_process').exec
with a 1 minute timeout it returns [Error: Command failed: ] killed: true, code: null, signal: 'SIGTERM'
after 1 minute?
P.S. that command generates some files and in both cases the output is ok.
Update: example of such behaviour:
var exec = require('child_process').exec
exec('docker run --rm -i ubuntu sleep 1',
{timeout:15000},
function(){
console.log(arguments)
}
)
Upvotes: 0
Views: 1453
Reputation: 671
If you remove the -i
flag, it will work fine.
The -i
"interactive" flag in Docker causes the STDIN
to be opened and the exec won't like it by default.
Upvotes: 1