Merge branch 'master' of github.com:NuSkooler/enigma-bbs into 216-waiting-for-caller

This commit is contained in:
Bryan Ashby
2020-11-09 19:38:16 -07:00
8 changed files with 58 additions and 21 deletions

View File

@@ -319,7 +319,7 @@ module.exports = class ArchiveUtil {
}
let output = '';
proc.on('data', data => {
proc.onData(data => {
// :TODO: hack for: execvp(3) failed.: No such file or directory
output += data;

View File

@@ -3,12 +3,14 @@
const stringFormat = require('./string_format.js');
const { Errors } = require('./enig_error.js');
const Events = require('./events');
// deps
const pty = require('node-pty');
const decode = require('iconv-lite').decode;
const createServer = require('net').createServer;
const paths = require('path');
const _ = require('lodash');
module.exports = class Door {
constructor(client) {
@@ -87,6 +89,19 @@ module.exports = class Door {
return cb(e);
}
//
// PID is launched. Make sure it's killed off if the user disconnects.
//
Events.once(Events.getSystemEvents().ClientDisconnected, evt => {
if (this.doorPty && this.client.session.uniqueId === _.get(evt, 'client.session.uniqueId')) {
this.client.log.info(
{ pid : this.doorPty.pid },
'User has disconnected; Killing door process.'
);
this.doorPty.kill();
}
});
this.client.log.debug(
{ processId : this.doorPty.pid }, 'External door process spawned'
);
@@ -96,7 +111,7 @@ module.exports = class Door {
this.client.term.output.pipe(this.doorPty);
this.doorPty.on('data', this.doorDataHandler.bind(this));
this.doorPty.onData(this.doorDataHandler.bind(this));
this.doorPty.once('close', () => {
return this.restoreIo(this.doorPty);

View File

@@ -426,7 +426,7 @@ exports.getModule = class TransferFileModule extends MenuModule {
}
});
externalProc.on('data', data => {
externalProc.onData(data => {
updateActivity();
// needed for things like sz/rz

View File

@@ -56,7 +56,7 @@ function stringToNullPaddedBuffer(s, bufLen) {
//
// Convert a FTN style DateTime string to a Date object
//
// :TODO: Name the next couple methods better - for FTN *packets*
// :TODO: Name the next couple methods better - for FTN *packets* e.g. parsePacketDateTime()
function getDateFromFtnDateTime(dateTime) {
//
// Examples seen in the wild (Working):
@@ -66,7 +66,6 @@ function getDateFromFtnDateTime(dateTime) {
//
// :TODO: Use moment.js here
return moment(Date.parse(dateTime)); // Date.parse() allows funky formats
// return (new Date(Date.parse(dateTime))).toISOString();
}
function getDateTimeString(m) {