Fix onExit(): emits a object containing exitCode and signal
This commit is contained in:
parent
b87ff51160
commit
ca985dd2cb
|
@ -214,11 +214,11 @@ module.exports = class ArchiveUtil {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
proc.onExit(exitCode => {
|
proc.onExit(exitEvent => {
|
||||||
return cb(
|
return cb(
|
||||||
exitCode
|
exitCode
|
||||||
? Errors.ExternalProcess(
|
? Errors.ExternalProcess(
|
||||||
`${action} failed with exit code: ${exitCode}`
|
`${action} failed with exit code: ${exitEvent.exitCode}`
|
||||||
)
|
)
|
||||||
: err
|
: err
|
||||||
);
|
);
|
||||||
|
@ -358,10 +358,10 @@ module.exports = class ArchiveUtil {
|
||||||
output += data;
|
output += data;
|
||||||
});
|
});
|
||||||
|
|
||||||
proc.onExit(exitCode => {
|
proc.onExit(exitEvent => {
|
||||||
if (exitCode) {
|
if (exitEvent.exitCode) {
|
||||||
return cb(
|
return cb(
|
||||||
Errors.ExternalProcess(`List failed with exit code: ${exitCode}`)
|
Errors.ExternalProcess(`List failed with exit code: ${exitEvent.exitCode}`)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
12
core/door.js
12
core/door.js
|
@ -113,9 +113,10 @@ module.exports = class Door {
|
||||||
spawnOptions
|
spawnOptions
|
||||||
);
|
);
|
||||||
|
|
||||||
prePty.onExit(exitCode => {
|
prePty.onExit(exitEvent => {
|
||||||
|
const {exitCode, signal} = exitEvent;
|
||||||
this.client.log.info(
|
this.client.log.info(
|
||||||
{ exitCode: exitCode },
|
{ exitCode, signal },
|
||||||
'Door pre-command exited'
|
'Door pre-command exited'
|
||||||
);
|
);
|
||||||
return callback(null);
|
return callback(null);
|
||||||
|
@ -165,7 +166,7 @@ module.exports = class Door {
|
||||||
|
|
||||||
this.doorPty.onData(this.doorDataHandler.bind(this));
|
this.doorPty.onData(this.doorDataHandler.bind(this));
|
||||||
|
|
||||||
this.doorPty.onExit(exitCode => {
|
this.doorPty.onExit( (/*exitEvent*/) => {
|
||||||
return this.restoreIo(this.doorPty);
|
return this.restoreIo(this.doorPty);
|
||||||
});
|
});
|
||||||
} else if ('socket' === this.io) {
|
} else if ('socket' === this.io) {
|
||||||
|
@ -178,8 +179,9 @@ module.exports = class Door {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.doorPty.onExit(exitCode => {
|
this.doorPty.onExit(exitEvent => {
|
||||||
this.client.log.info({ exitCode: exitCode }, 'Door exited');
|
const {exitCode, signal} = exitEvent;
|
||||||
|
this.client.log.info({ exitCode, signal }, 'Door exited');
|
||||||
|
|
||||||
if (this.sockServer) {
|
if (this.sockServer) {
|
||||||
this.sockServer.close();
|
this.sockServer.close();
|
||||||
|
|
|
@ -166,18 +166,18 @@ class ScheduledEvent {
|
||||||
});
|
});
|
||||||
return cb(e);
|
return cb(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
proc.onExit(exitCode => {
|
proc.onExit(exitEvent => {
|
||||||
if (exitCode) {
|
if (exitEvent.exitCode) {
|
||||||
Log.warn(
|
Log.warn(
|
||||||
{ eventName: this.name, action: this.action, exitCode: exitCode },
|
{ eventName: this.name, action: this.action, exitCode: exitEvent.exitCode },
|
||||||
'Bad exit code while performing scheduled event action'
|
'Bad exit code while performing scheduled event action'
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
return cb(
|
return cb(
|
||||||
exitCode
|
exitEvent.exitCode
|
||||||
? Errors.ExternalProcess(
|
? Errors.ExternalProcess(
|
||||||
`Bad exit code while performing scheduled event action: ${exitCode}`
|
`Bad exit code while performing scheduled event action: ${exitEvent.exitCode}`
|
||||||
)
|
)
|
||||||
: null
|
: null
|
||||||
);
|
);
|
||||||
|
|
|
@ -485,9 +485,10 @@ exports.getModule = class TransferFileModule extends MenuModule {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
externalProc.onExit(exitCode => {
|
externalProc.onExit(exitEvent => {
|
||||||
|
const {exitCode, signal} = exitEvent;
|
||||||
this.client.log.debug(
|
this.client.log.debug(
|
||||||
{ cmd: cmd, args: args, exitCode: exitCode },
|
{ cmd: cmd, args: args, exitCode, signal },
|
||||||
'Process exited'
|
'Process exited'
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue