Skip to content

Commit

Permalink
changed standalone run function to stdin: 'null'; finding an error in…
Browse files Browse the repository at this point in the history
… real world use that did not show in tests
  • Loading branch information
j50n committed Jun 8, 2023
1 parent c6fc7db commit bfff343
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
4 changes: 2 additions & 2 deletions src/command.ts
Original file line number Diff line number Diff line change
Expand Up @@ -274,8 +274,8 @@ export class Process<S> implements Deno.Closer {
* This is the "backdoor" way to write directly to the underlying process `stdin`
* without the overhead of a {@link WritableIterable}. Use instead of {@link stdin}
* for streamed data.
*
* {@link stdin} is the way to go if you are passing ad-hoc, non-continuous data to
*
* {@link stdin} is the way to go if you are passing ad-hoc, non-continuous data to
* process `stdin`. However, it adds a substantial amount of overhead, and it is very
* slow for processing small data. Using this function instead of {@link stdin} greatly
* improves performance where small data is a factor.
Expand Down
8 changes: 4 additions & 4 deletions src/enumerable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -132,9 +132,9 @@ export class Enumerable<T> implements AsyncIterable<T> {
mapFn: (item: T) => Promise<U>,
concurrency?: number,
): Enumerable<U> {
const iterable = this.iter;
const iter = this.iter;
return new Enumerable(
concurrentMap(iterable, mapFn, concurrency),
concurrentMap(iter, mapFn, concurrency),
) as Enumerable<U>;
}

Expand All @@ -153,9 +153,9 @@ export class Enumerable<T> implements AsyncIterable<T> {
mapFn: (item: T) => Promise<U>,
concurrency?: number,
): Enumerable<U> {
const iterable = this.iter;
const iter = this.iter;
return new Enumerable(
concurrentUnorderedMap(iterable, mapFn, concurrency),
concurrentUnorderedMap(iter, mapFn, concurrency),
) as Enumerable<U>;
}

Expand Down
5 changes: 4 additions & 1 deletion src/run.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,14 @@ export function run<S>(
{
...options,
stdout: "piped",
stdin: "null",
stderr: options.fnStderr == null ? "inherit" : "piped",
},
command,
...args,
);

return new Uint8Enumerable(c.spawn().stdout);
const process = c.spawn();

return new Uint8Enumerable(process.stdout);
}

0 comments on commit bfff343

Please sign in to comment.