fix: flush CLI stdio before forced exit
This commit is contained in:
parent
f0a0196c4d
commit
65e4051662
@ -380,6 +380,9 @@ function flushWriteStream(stream: NodeJS.WriteStream, timeoutMs: number): Promis
|
||||
if (!stream.writable || stream.destroyed || stream.writableEnded) {
|
||||
return Promise.resolve();
|
||||
}
|
||||
if (stream.writableLength === 0 && !stream.writableNeedDrain) {
|
||||
return Promise.resolve();
|
||||
}
|
||||
|
||||
return new Promise((resolve) => {
|
||||
let settled = false;
|
||||
|
||||
@ -50,6 +50,10 @@ const [cliEntry, configPath] = process.argv.slice(2);
|
||||
process.env.MCPORTER_DISABLE_AUTORUN = '1';
|
||||
|
||||
let cleanupWriteSeen = false;
|
||||
Object.defineProperty(process.stdout, 'writableNeedDrain', {
|
||||
configurable: true,
|
||||
get: () => true,
|
||||
});
|
||||
const originalWrite = process.stdout.write.bind(process.stdout);
|
||||
process.stdout.write = (chunk, encoding, callback) => {
|
||||
const done = typeof encoding === 'function' ? encoding : callback;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user