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) {
|
function readlineExt(options) {
|
||||||
var hostArgs, res = {},
|
var hostArgs, res = {}, extMessage,
|
||||||
execOptions = {env: process.env, encoding: options.encoding};
|
execOptions = {env: process.env, encoding: options.encoding};
|
||||||
|
|
||||||
if (!extHostPath) {
|
if (!extHostPath) {
|
||||||
|
@ -251,11 +251,12 @@ function readlineExt(options) {
|
||||||
try {
|
try {
|
||||||
res.input = childProc.execFileSync(extHostPath, hostArgs, execOptions);
|
res.input = childProc.execFileSync(extHostPath, hostArgs, execOptions);
|
||||||
} catch (e) { // non-zero exit code
|
} 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.method = 'execFileSync';
|
||||||
res.error.program = extHostPath;
|
res.error.program = extHostPath;
|
||||||
res.error.args = hostArgs;
|
res.error.args = hostArgs;
|
||||||
res.error.extMessage = e.stderr.trim();
|
res.error.extMessage = extMessage;
|
||||||
res.error.exitCode = e.status;
|
res.error.exitCode = e.status;
|
||||||
res.error.code = e.code;
|
res.error.code = e.code;
|
||||||
res.error.signal = e.signal;
|
res.error.signal = e.signal;
|
||||||
|
@ -296,7 +297,7 @@ function _execFileSync(options, execOptions) {
|
||||||
return filepath;
|
return filepath;
|
||||||
}
|
}
|
||||||
|
|
||||||
var hostArgs, shellPath, shellArgs, res = {}, exitCode,
|
var hostArgs, shellPath, shellArgs, res = {}, exitCode, extMessage,
|
||||||
pathStdout = getTempfile('readline-sync.stdout'),
|
pathStdout = getTempfile('readline-sync.stdout'),
|
||||||
pathStderr = getTempfile('readline-sync.stderr'),
|
pathStderr = getTempfile('readline-sync.stderr'),
|
||||||
pathExit = getTempfile('readline-sync.exit'),
|
pathExit = getTempfile('readline-sync.exit'),
|
||||||
|
@ -353,12 +354,12 @@ function _execFileSync(options, execOptions) {
|
||||||
'hex', options.encoding) +
|
'hex', options.encoding) +
|
||||||
decipher.final(options.encoding);
|
decipher.final(options.encoding);
|
||||||
} else {
|
} 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.method = '_execFileSync';
|
||||||
res.error.program = shellPath;
|
res.error.program = shellPath;
|
||||||
res.error.args = shellArgs;
|
res.error.args = shellArgs;
|
||||||
res.error.extMessage =
|
res.error.extMessage = extMessage;
|
||||||
fs.readFileSync(pathStderr, {encoding: options.encoding}).trim();
|
|
||||||
res.error.exitCode = +exitCode;
|
res.error.exitCode = +exitCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "readline-sync",
|
"name": "readline-sync",
|
||||||
"version": "1.2.12",
|
"version": "1.2.13",
|
||||||
"title": "readlineSync",
|
"title": "readlineSync",
|
||||||
"description": "Synchronous Readline for interactively running to have a conversation with the user via a console(TTY).",
|
"description": "Synchronous Readline for interactively running to have a conversation with the user via a console(TTY).",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
|
|
Loading…
Reference in a new issue