From 94f5fec4c4ca30c7ec70025485c768b0535f7d2e Mon Sep 17 00:00:00 2001 From: Ian Egner Date: Wed, 16 Aug 2017 16:07:10 +0100 Subject: [PATCH] fix(exec): make `exec` timeout configurable I need to increase the timeout when using https://github.com/Turistforeningen/node-s3-uploader, I thought changing the default via process.env is easier than adding a new config variable in both packages --- index.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index 16654d1..1cc53b7 100644 --- a/index.js +++ b/index.js @@ -8,7 +8,8 @@ var sprintf = require('util').format; module.exports = function(image, output, cb) { var cmd = module.exports.cmd(image, output); - exec(cmd, {timeout: 30000}, function(e, stdout, stderr) { + var timeout = process.env.IM_TIMEOUT ? parseInt(process.env.IM_TIMEOUT) : 30000 + exec(cmd, {timeout}, function(e, stdout, stderr) { if (e) { return cb(e); } if (stderr) { return cb(new Error(stderr)); }