diff --git a/core/abracadabra.js b/core/abracadabra.js index 32c4466a..e448315b 100644 --- a/core/abracadabra.js +++ b/core/abracadabra.js @@ -9,9 +9,11 @@ const ansi = require('./ansi_term.js'); const Events = require('./events.js'); const { Errors } = require('./enig_error.js'); +// deps const async = require('async'); const assert = require('assert'); const _ = require('lodash'); +const paths = require('path'); const activeDoorNodeInstances = {}; @@ -153,7 +155,7 @@ exports.getModule = class AbracadabraModule extends MenuModule { const exeInfo = { cmd : this.config.cmd, - cwd : this.config.cwd, // null/undefined = parent_of(cmd) + cwd : this.config.cwd || paths.dirname(this.config.cmd), args : this.config.args, io : this.config.io || 'stdio', encoding : this.config.encoding || 'cp437', diff --git a/core/door.js b/core/door.js index d6326cbe..eb01d6fa 100644 --- a/core/door.js +++ b/core/door.js @@ -71,13 +71,23 @@ module.exports = class Door { const args = exeInfo.args.map( arg => stringFormat(arg, formatObj) ); - const door = pty.spawn(exeInfo.cmd, args, { - cols : this.client.term.termWidth, - rows : this.client.term.termHeight, - cwd : cwd, - env : exeInfo.env, - encoding : null, // we want to handle all encoding ourself - }); + this.client.log.debug( + { cmd : exeInfo.cmd, args, io : this.io }, + 'Executing door' + ); + + let door; + try { + door = pty.spawn(exeInfo.cmd, args, { + cols : this.client.term.termWidth, + rows : this.client.term.termHeight, + cwd : cwd, + env : exeInfo.env, + encoding : null, // we want to handle all encoding ourself + }); + } catch(e) { + return cb(e); + } if('stdio' === this.io) { this.client.log.debug('Using stdio for door I/O'); diff --git a/core/dropfile.js b/core/dropfile.js index 6595aa1a..eb3d9136 100644 --- a/core/dropfile.js +++ b/core/dropfile.js @@ -16,6 +16,7 @@ const { mkdirs } = require('fs-extra'); // // Resources +// * https://github.com/NuSkooler/ansi-bbs/tree/master/docs/dropfile_formats // * http://goldfndr.home.mindspring.com/dropfile/ // * https://en.wikipedia.org/wiki/Talk%3ADropfile // * http://thoughtproject.com/libraries/bbs/Sysop/Doors/DropFiles/index.htm @@ -36,7 +37,7 @@ module.exports = class DropFile { get fileName() { return { DOOR : 'DOOR.SYS', // GAP BBS, many others - DOOR32 : 'DOOR32.SYS', // EleBBS / Mystic, Syncronet, Maximus, Telegard, AdeptXBBS, ... + DOOR32 : 'door32.sys', // Mystic, EleBBS, Syncronet, Maximus, Telegard, AdeptXBBS (lowercase name as per spec) CALLINFO : 'CALLINFO.BBS', // Citadel? DORINFO : this.getDoorInfoFileName(), // RBBS, RemoteAccess, QBBS, ... CHAIN : 'CHAIN.TXT', // WWIV @@ -155,6 +156,7 @@ module.exports = class DropFile { // // Resources: // * http://wiki.bbses.info/index.php/DOOR32.SYS + // * https://github.com/NuSkooler/ansi-bbs/blob/master/docs/dropfile_formats/door32_sys.txt // // :TODO: local/serial/telnet need to be configurable -- which also changes socket handle! const Door32CommTypes = {