🩹 back cli: minor fixes for output flush
This commit is contained in:
committed by
Anton Shepilov
parent
5e94c91c01
commit
99d78ad5ac
@@ -8,6 +8,10 @@ import type { TdrivePlatform } from "../../core/platform/platform";
|
||||
//TODO: When this gets used for all commands; update verboseDuringRun from search/index-all and move to root index
|
||||
// And consider moving print-config-summary call here.
|
||||
|
||||
const waitForFlush = (stream: NodeJS.WriteStream) =>
|
||||
new Promise<void>((resolve, reject) =>
|
||||
stream.write("\r\n", err => (err ? reject(err) : resolve())),
|
||||
);
|
||||
/**
|
||||
* Start the platform and its services, run the command (passed as
|
||||
* the `handler` callback), then cleanly shut down the platform.
|
||||
@@ -36,7 +40,7 @@ export default async function runWithPlatform(
|
||||
process.exitCode = 1;
|
||||
}
|
||||
// Spinner seems to interrupt still buffered output otherwise
|
||||
await new Promise(resolve => setTimeout(resolve, 200));
|
||||
await Promise.all([waitForFlush(process.stdout), waitForFlush(process.stderr)]);
|
||||
spinner.start("Platform: shutting down...");
|
||||
await platform.stop();
|
||||
spinner.succeed("Platform: shutdown");
|
||||
|
||||
@@ -45,7 +45,6 @@ async function runInBatches<T, R>(
|
||||
let batch;
|
||||
const result = [] as R[];
|
||||
while ((batch = listCopy.splice(0, batchSize)).length) {
|
||||
console.error("batch", batch);
|
||||
result.push(await map(batch));
|
||||
}
|
||||
return result;
|
||||
|
||||
Reference in New Issue
Block a user