diff --git a/lib/terminals/uacwrapper.js b/lib/terminals/uacwrapper.js index 189d23d..a7bce92 100644 --- a/lib/terminals/uacwrapper.js +++ b/lib/terminals/uacwrapper.js @@ -31,7 +31,7 @@ class UACClient extends base_1.TerminalBase { // Create a named pipe for IPC between clones. const pipe = `uniterm-${process.pid}-${(await randomBytesAsync(16)).toString('hex')}`; net_1.createServer() - .listen(path_1.join(`\\\\.\\pipe`, pipe)) + .listen(path_1.join('\\\\.\\pipe', pipe)) .once('connection', this.handleConnection) .once('connection', closeServer); this._pushData('SUDO: Waiting to confirm getting administrator privileges...\r\n'); @@ -146,7 +146,8 @@ class UACClient extends base_1.TerminalBase { dataSize += buffer.readUInt32BE(1) + 4; if (buffer.length < dataSize) return; - throw new Error(`Remote error: ${buffer.toString('utf8', 5, dataSize)}`); + this.emit('error', new Error(`Remote error: ${buffer.toString('utf8', 5, dataSize)}`)); + break; case 255 /* Exit */: dataSize += 4; if (buffer.length < dataSize) diff --git a/lib/terminals/uacwrapper.js.map b/lib/terminals/uacwrapper.js.map index 2c727ca..f91dae9 100644 --- a/lib/terminals/uacwrapper.js.map +++ b/lib/terminals/uacwrapper.js.map @@ -1 +1 @@ -{"version":3,"file":"uacwrapper.js","sourceRoot":"","sources":["../../src/terminals/uacwrapper.ts"],"names":[],"mappings":";;AAAA,iDAAyC;AACzC,mCAAqC;AACrC,8CAA8C;AAC9C,6BAAmD;AACnD,+BAAkD;AAClD,+BAAiC;AACjC,4CAA0C;AAC1C,sDAA6C;AAC7C,iCAAuD;AAGvD,MAAM,eAAe,GAAG,yBAAQ,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,MAAM,yBAAQ,CAAC,GAAG,CAAC,UAAU,EAAE,KAAK,CAAC;AAC5F,MAAM,OAAO,GAAG,yBAAQ,CAAC,GAAG,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AAC5C,MAAM,gBAAgB,GAAG,gBAAS,CAAC,oBAAW,CA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MAAM,IAAI,KAAK,CAAC,iBAAiB,GAAG,EAAE,CAAC,CAAC;iBAClD;aACF;YAAC,OAAM,KAAK,EAAE;gBACb,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,QAAQ,KAAK,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,IAAI,KAAK,CAAC,CAAC,CAAC;gBAC/E,IAAG,IAAI,CAAC,GAAG,EAAE;oBACX,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC;oBACf,OAAO,IAAI,CAAC,GAAG,CAAC;iBACjB;gBACD,OAAO;aACR;YACD,IAAG,MAAM,CAAC,MAAM,GAAG,QAAQ;gBACzB,IAAI,CAAC,SAAS,GAAG,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;;gBAExC,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;YAC7B,QAAQ,GAAG,CAAC,CAAC;SACd;IACH,CAAC;IAEO,WAAW,CAAC,KAAa;QAC/B,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;IAC5B,CAAC;IAEO,kBAAkB,CAAC,IAAa;QACtC,IAAG,IAAI,EAAE;YACP,IAAG,IAAI,CAAC,GAAG,EAAE;gBACX,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC;gBACf,OAAO,IAAI,CAAC,GAAG,CAAC;aACjB;YACD,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,KAAK,CAAC,wCAAwC,CAAC,CAAC,CAAC;SACzE;IACH,CAAC;IAEO,UAAU;QAChB,OAAO,IAAI,CAAC,GAAG,CAAC;IAClB,CAAC;CACF;AA5KD,8BA4KC"} \ No newline at end of file +{"version":3,"file":"uacwrapper.js","sourceRoot":"","sources":["../../src/terminals/uacwrapper.ts"],"names":[],"mappings":";;AAAA,iDAAyC;AACzC,mCAAqC;AACrC,8CAA8C;AAC9C,6BAAmD;AACnD,+BAAkD;AAClD,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f,OAAO,IAAI,CAAC,GAAG,CAAC;aACjB;YACD,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,KAAK,CAAC,wCAAwC,CAAC,CAAC,CAAC;SACzE;IACH,CAAC;IAEO,UAAU;QAChB,OAAO,IAAI,CAAC,GAAG,CAAC;IAClB,CAAC;CACF;AA7KD,8BA6KC"} \ No newline at end of file diff --git a/src/terminals/uacwrapper.ts b/src/terminals/uacwrapper.ts index 1025e24..0d0c886 100644 --- a/src/terminals/uacwrapper.ts +++ b/src/terminals/uacwrapper.ts @@ -37,7 +37,7 @@ export class UACClient extends TerminalBase { // Create a named pipe for IPC between clones. const pipe = `uniterm-${process.pid}-${(await randomBytesAsync(16)).toString('hex')}`; createServer() - .listen(joinPath(`\\\\.\\pipe`, pipe)) + .listen(joinPath('\\\\.\\pipe', pipe)) .once('connection', this.handleConnection) .once('connection', closeServer); this._pushData('SUDO: Waiting to confirm getting administrator privileges...\r\n'); @@ -148,7 +148,8 @@ export class UACClient extends TerminalBase { case CMDType.Error: dataSize += buffer.readUInt32BE(1) + 4; if(buffer.length < dataSize) return; - throw new Error(`Remote error: ${buffer.toString('utf8', 5, dataSize)}`); + this.emit('error', new Error(`Remote error: ${buffer.toString('utf8', 5, dataSize)}`)); + break; case CMDType.Exit: dataSize += 4; if(buffer.length < dataSize) return;