fix: allow ETX to propagate to bash

This commit is contained in:
KernelDeimos 2024-09-26 15:47:35 -04:00
parent 08601ae2af
commit 259877b677
2 changed files with 13 additions and 1 deletions

View File

@ -200,7 +200,9 @@ export class PreparedCommand {
}
};
in_ = new SignalReader({ delegate: in_, sig });
if ( ! command.no_signal_reader ) {
in_ = new SignalReader({ delegate: in_, sig });
}
if ( command.input?.syncLines ) {
in_ = new SyncLinesReader({ delegate: in_ });

View File

@ -112,6 +112,7 @@ export class EmuCommandProvider {
name: id,
path: 'Emulator',
execute: this.execute.bind(this, { id, emu, ctx }),
no_signal_reader: true,
}
}
@ -128,6 +129,15 @@ export class EmuCommandProvider {
};
ctx.shell.addEventListener('signal.window-resize', resize_listener);
// Note: this won't be triggered because the signal reader is disabled,
// but if we ever need to enable it here this might be useful.
// ctx.externs.sig.on(signal => {
// if ( signal === signals.SIGINT ) emu.postMessage({
// $: 'stdin',
// data: '\x03', // ETX
// });
// })
// TODO: handle CLOSE -> emu needs to close connection first
const app_close_promise = new TeePromise();
const sigint_promise = new TeePromise();