Change: error message includes extMessage
This commit is contained in:
parent
1e7160c6d2
commit
64e65b27d3
3 changed files with 247 additions and 246 deletions
|
@ -222,7 +222,7 @@ function _readlineSync(options) {
|
|||
}
|
||||
|
||||
function readlineExt(options) {
|
||||
var hostArgs, res = {},
|
||||
var hostArgs, res = {}, extMessage,
|
||||
execOptions = {env: process.env, encoding: options.encoding};
|
||||
|
||||
if (!extHostPath) {
|
||||
|
@ -251,11 +251,12 @@ function readlineExt(options) {
|
|||
try {
|
||||
res.input = childProc.execFileSync(extHostPath, hostArgs, execOptions);
|
||||
} catch (e) { // non-zero exit code
|
||||
res.error = new Error(DEFAULT_ERR_MSG);
|
||||
extMessage = e.stderr.trim();
|
||||
res.error = new Error(DEFAULT_ERR_MSG + (extMessage ? '\n' + extMessage : ''));
|
||||
res.error.method = 'execFileSync';
|
||||
res.error.program = extHostPath;
|
||||
res.error.args = hostArgs;
|
||||
res.error.extMessage = e.stderr.trim();
|
||||
res.error.extMessage = extMessage;
|
||||
res.error.exitCode = e.status;
|
||||
res.error.code = e.code;
|
||||
res.error.signal = e.signal;
|
||||
|
@ -296,7 +297,7 @@ function _execFileSync(options, execOptions) {
|
|||
return filepath;
|
||||
}
|
||||
|
||||
var hostArgs, shellPath, shellArgs, res = {}, exitCode,
|
||||
var hostArgs, shellPath, shellArgs, res = {}, exitCode, extMessage,
|
||||
pathStdout = getTempfile('readline-sync.stdout'),
|
||||
pathStderr = getTempfile('readline-sync.stderr'),
|
||||
pathExit = getTempfile('readline-sync.exit'),
|
||||
|
@ -353,12 +354,12 @@ function _execFileSync(options, execOptions) {
|
|||
'hex', options.encoding) +
|
||||
decipher.final(options.encoding);
|
||||
} else {
|
||||
res.error = new Error(DEFAULT_ERR_MSG);
|
||||
extMessage = fs.readFileSync(pathStderr, {encoding: options.encoding}).trim();
|
||||
res.error = new Error(DEFAULT_ERR_MSG + (extMessage ? '\n' + extMessage : ''));
|
||||
res.error.method = '_execFileSync';
|
||||
res.error.program = shellPath;
|
||||
res.error.args = shellArgs;
|
||||
res.error.extMessage =
|
||||
fs.readFileSync(pathStderr, {encoding: options.encoding}).trim();
|
||||
res.error.extMessage = extMessage;
|
||||
res.error.exitCode = +exitCode;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "readline-sync",
|
||||
"version": "1.2.12",
|
||||
"version": "1.2.13",
|
||||
"title": "readlineSync",
|
||||
"description": "Synchronous Readline for interactively running to have a conversation with the user via a console(TTY).",
|
||||
"keywords": [
|
||||
|
|
Loading…
Reference in a new issue