bdy 1.9.49-dev → 1.9.50-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 +1 -1
- package/distTs/src/server/ssh.js +15 -21
- package/package.json +1 -1
package/distTs/package.json
CHANGED
package/distTs/src/server/ssh.js
CHANGED
|
@@ -10,6 +10,18 @@ const crypto_1 = require("crypto");
|
|
|
10
10
|
const child_process_1 = require("child_process");
|
|
11
11
|
const sftp_1 = __importDefault(require("./sftp"));
|
|
12
12
|
const buddy_1 = __importDefault(require("../api/buddy"));
|
|
13
|
+
const pipeStreamToChannel = (stream, channel) => {
|
|
14
|
+
channel.once('exit', (code, signal) => {
|
|
15
|
+
logger_js_1.default.debug(`shell channel exit: ${code}, signal: ${signal}`);
|
|
16
|
+
if (stream.exit)
|
|
17
|
+
stream.exit(signal || code);
|
|
18
|
+
});
|
|
19
|
+
channel.on('close', () => {
|
|
20
|
+
stream.end();
|
|
21
|
+
});
|
|
22
|
+
channel.pipe(stream, { end: false }).pipe(channel);
|
|
23
|
+
channel.stderr.pipe(stream.stderr);
|
|
24
|
+
};
|
|
13
25
|
class ServerSsh extends events_1.default {
|
|
14
26
|
constructor(agent, login, password, hostKey) {
|
|
15
27
|
super();
|
|
@@ -216,13 +228,7 @@ class ServerSsh extends events_1.default {
|
|
|
216
228
|
reject();
|
|
217
229
|
return;
|
|
218
230
|
}
|
|
219
|
-
|
|
220
|
-
channel.once('exit', (code) => {
|
|
221
|
-
if (stream && stream.exit)
|
|
222
|
-
stream.exit(code);
|
|
223
|
-
});
|
|
224
|
-
stream.pipe(channel);
|
|
225
|
-
channel.pipe(stream);
|
|
231
|
+
pipeStreamToChannel(stream, c);
|
|
226
232
|
});
|
|
227
233
|
});
|
|
228
234
|
session.on('signal', (accept, reject, info) => {
|
|
@@ -254,13 +260,7 @@ class ServerSsh extends events_1.default {
|
|
|
254
260
|
reject();
|
|
255
261
|
return;
|
|
256
262
|
}
|
|
257
|
-
|
|
258
|
-
channel.once('exit', (code) => {
|
|
259
|
-
if (stream && stream.exit)
|
|
260
|
-
stream.exit(code);
|
|
261
|
-
});
|
|
262
|
-
stream.pipe(channel);
|
|
263
|
-
channel.pipe(stream);
|
|
263
|
+
pipeStreamToChannel(stream, c);
|
|
264
264
|
});
|
|
265
265
|
});
|
|
266
266
|
session.on('x11', (accept, reject, info) => {
|
|
@@ -298,13 +298,7 @@ class ServerSsh extends events_1.default {
|
|
|
298
298
|
reject();
|
|
299
299
|
return;
|
|
300
300
|
}
|
|
301
|
-
|
|
302
|
-
channel.once('exit', (code) => {
|
|
303
|
-
if (stream && stream.exit)
|
|
304
|
-
stream.exit(code);
|
|
305
|
-
});
|
|
306
|
-
stream.pipe(channel);
|
|
307
|
-
channel.pipe(stream);
|
|
301
|
+
pipeStreamToChannel(stream, c);
|
|
308
302
|
});
|
|
309
303
|
});
|
|
310
304
|
session.on('env', (accept, reject, info) => {
|