deno - replace deprecated Deno.run with Deno.Command#8893
deno - replace deprecated Deno.run with Deno.Command#8893
Conversation
|
This is a bit obnoxious. Using Deno.Command crashes (The CI output doesn't show this stack trace, I obtained it locally) |
|
We're blocked here until we upgrade Deno, I think. But we're blocked on upgrading Deno until we confirm that the fix for denoland/deno#22180 has landed and resolves our issues. It seems that Deno v1.40.3 fixed that problem, so we should try again. |
|
This PR is currently blocked by a Deno v1.41.0 bug with the following repro: deno_repro.tsasync function processOutput(iterator: AsyncIterable<Uint8Array>): Promise<string> {
const decoder = new TextDecoder();
let outputText = "";
for await (const chunk of iterator) {
const text = decoder.decode(chunk);
outputText += text;
}
return outputText;
}
async function* iteratorFromStream(stream: ReadableStream<Uint8Array>) {
const reader = stream.getReader();
try {
while (true) {
const { done, value } = await reader.read();
if (done) return;
yield value;
}
} finally {
reader.releaseLock();
}
}
const command = new Deno.Command("ls", {stdout: "piped", stderr: "piped"});
const process = command.spawn();
const promises: Promise<unknown>[] = [
processOutput(iteratorFromStream(process.stdout)),
processOutput(iteratorFromStream(process.stderr)),
];
await Promise.all(promises);
// assertion fails here
const status = await process.output(); |
|
Upstream deno bug report: denoland/deno#22621 |
This reverts commit aeaa157.
|
We're fixing the upstream bug now, but you can unblock yourself here by using |
Closes #8891.