bdy 1.22.22-dev → 1.22.23-dev
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/distTs/package.json
CHANGED
|
@@ -46,6 +46,22 @@ class ServerSftp {
|
|
|
46
46
|
this.count = 0;
|
|
47
47
|
this.sftp = sftp;
|
|
48
48
|
this.home = (0, node_os_1.homedir)();
|
|
49
|
+
// fix for sftp/scp exit status -1: send exit-status and EOF before channel close
|
|
50
|
+
// https://github.com/mscdex/ssh2/pull/1492
|
|
51
|
+
const s = sftp;
|
|
52
|
+
const origDestroy = s.destroy.bind(s);
|
|
53
|
+
s.destroy = () => {
|
|
54
|
+
try {
|
|
55
|
+
if (s.outgoing?.state === 'open') {
|
|
56
|
+
s._protocol.exitStatus(s.outgoing.id, 0);
|
|
57
|
+
s._protocol.channelEOF(s.outgoing.id);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
catch {
|
|
61
|
+
// do nothing
|
|
62
|
+
}
|
|
63
|
+
return origDestroy();
|
|
64
|
+
};
|
|
49
65
|
this.sftp.on('OPEN', (reqId, fileName, flags, attrs) => this.open(reqId, fileName, flags, attrs));
|
|
50
66
|
this.sftp.on('READ', (reqId, handle, offset, length) => this.read(reqId, handle, offset, length));
|
|
51
67
|
this.sftp.on('WRITE', (reqId, handle, offset, data) => this.write(reqId, handle, offset, data));
|
|
@@ -251,16 +251,6 @@ class ServerSsh extends events_1.default {
|
|
|
251
251
|
session.on('close', () => closeSession());
|
|
252
252
|
session.on('end', () => closeSession());
|
|
253
253
|
session.on('eof', () => {
|
|
254
|
-
// fix for sftp/scp exit status -1: send exit-status before EOF https://github.com/mscdex/ssh2/pull/1492
|
|
255
|
-
if (sftp) {
|
|
256
|
-
try {
|
|
257
|
-
logger_1.default.debug('sftp eof: sending exit-status 0');
|
|
258
|
-
session.exit(0);
|
|
259
|
-
}
|
|
260
|
-
catch {
|
|
261
|
-
// do nothing
|
|
262
|
-
}
|
|
263
|
-
}
|
|
264
254
|
// @ts-ignore fix for sftp channel not ending properly https://github.com/mscdex/ssh2/pull/1111
|
|
265
255
|
if (session._channel) {
|
|
266
256
|
try {
|