Merge pull request #489 from NuSkooler/bugfix/node_v20

Updated node-pty to support new node versions
This commit is contained in:
Bryan Ashby 2023-10-12 20:28:00 -06:00 committed by GitHub
commit bbfef536e0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 612 additions and 652 deletions

17
.vscode/launch.json vendored
View File

@ -1,17 +0,0 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "Launch Program",
"skipFiles": [
"<node_internals>/**"
],
"program": "${workspaceFolder}/main.js"
}
]
}

View File

@ -208,17 +208,17 @@ module.exports = class ArchiveUtil {
// pty.js doesn't currently give us a error when things fail, // pty.js doesn't currently give us a error when things fail,
// so we have this horrible, horrible hack: // so we have this horrible, horrible hack:
let err; let err;
proc.once('data', d => { proc.onData(d => {
if (_.isString(d) && d.startsWith('execvp(3) failed.')) { if (_.isString(d) && d.startsWith('execvp(3) failed.')) {
err = Errors.ExternalProcess(`${action} failed: ${d.trim()}`); err = Errors.ExternalProcess(`${action} failed: ${d.trim()}`);
} }
}); });
proc.once('exit', 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.once('exit', 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}`)
); );
} }

View File

@ -115,9 +115,10 @@ module.exports = class Door {
spawnOptions spawnOptions
); );
prePty.once('exit', 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);
@ -167,7 +168,7 @@ module.exports = class Door {
this.doorPty.onData(this.doorDataHandler.bind(this)); this.doorPty.onData(this.doorDataHandler.bind(this));
this.doorPty.once('close', () => { this.doorPty.onExit( (/*exitEvent*/) => {
return this.restoreIo(this.doorPty); return this.restoreIo(this.doorPty);
}); });
} else if ('socket' === this.io) { } else if ('socket' === this.io) {
@ -180,8 +181,9 @@ module.exports = class Door {
); );
} }
this.doorPty.once('exit', 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();

View File

@ -167,17 +167,17 @@ class ScheduledEvent {
return cb(e); return cb(e);
} }
proc.once('exit', 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
); );

View File

@ -485,13 +485,10 @@ exports.getModule = class TransferFileModule extends MenuModule {
} }
}); });
externalProc.once('close', () => { externalProc.onExit(exitEvent => {
return this.restorePipeAfterExternalProc(); const {exitCode, signal} = exitEvent;
});
externalProc.once('exit', exitCode => {
this.client.log.debug( this.client.log.debug(
{ cmd: cmd, args: args, exitCode: exitCode }, { cmd: cmd, args: args, exitCode, signal },
'Process exited' 'Process exited'
); );

View File

@ -50,7 +50,7 @@
"minimist": "^1.2.6", "minimist": "^1.2.6",
"moment": "2.29.4", "moment": "2.29.4",
"nntp-server": "3.1.0", "nntp-server": "3.1.0",
"node-pty": "0.10.1", "node-pty": "1.0.0",
"nodemailer": "6.7.7", "nodemailer": "6.7.7",
"otplib": "11.0.1", "otplib": "11.0.1",
"qrcode-generator": "^1.4.4", "qrcode-generator": "^1.4.4",

1202
yarn.lock

File diff suppressed because it is too large Load Diff