From 7dfc99989fbf59f0bb2791c315fc7b02a757a474 Mon Sep 17 00:00:00 2001 From: Joe Fitzgerald Date: Thu, 10 Nov 2016 14:23:08 -0700 Subject: [PATCH] Timeout when invoking the shell, log information to the console - Partially addresses #13084 --- src/update-process-env.js | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/update-process-env.js b/src/update-process-env.js index 6544a6612..227f0914f 100644 --- a/src/update-process-env.js +++ b/src/update-process-env.js @@ -63,7 +63,18 @@ function getEnvFromShell (env) { return } - let {stdout} = spawnSync(env.SHELL, ['-ilc', 'command env'], {encoding: 'utf8'}) + let {stdout, error, status, signal} = spawnSync(env.SHELL, ['-ilc', 'command env'], {encoding: 'utf8', timeout: 5000}) + if (error) { + if (error.handle) { + error.handle() + } + console.log(error) + } + + if (status !== 0) { + console.log('warning: ' + env.SHELL + '-ilc "command env" failed with status (' + status + ') and signal (' + signal + ')') + } + if (stdout) { let result = {} for (let line of stdout.split('\n')) {