Skip to content

Commit

Permalink
fix: remove inputs parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
exKAZUu committed Jun 7, 2024
1 parent 55c2c17 commit 5aaee87
Showing 1 changed file with 0 additions and 13 deletions.
13 changes: 0 additions & 13 deletions packages/shared-lib-node/src/spawn.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import type {
StdioPipe,
} from 'node:child_process';
import { spawn } from 'node:child_process';
import { setTimeout } from 'node:timers/promises';

import treeKill from 'tree-kill';

Expand All @@ -26,7 +25,6 @@ export type SpawnAsyncOptions = (
| SpawnOptions
) & {
input?: string;
inputs?: { data: string; time: number }[];
mergeOutAndError?: boolean;
killOnExit?: boolean;
verbose?: boolean;
Expand Down Expand Up @@ -97,17 +95,6 @@ export async function spawnAsync(
if (options?.input) {
proc.stdin?.write(options.input);
proc.stdin?.end();
} else if (options?.inputs) {
const inputs = options.inputs.sort((a, b) => a.time - b.time);
void (async () => {
const startTime = Date.now();
for (const { data, time } of inputs) {
await setTimeout(time - (Date.now() - startTime));
if (stopped) return;
proc.stdin?.write(data);
}
proc.stdin?.end();
})();
}
} catch (error) {
reject(error);
Expand Down

0 comments on commit 5aaee87

Please sign in to comment.