rauniorooR
Deno3y ago
raunioroo

await writer.write(buffer) never resolves on Deno.Command

Hiho. I'm creating a
Deno.Command
that writes a buffer to
vipsthumbnail
via stdin (and reads the result via stdout).

It works most of the time, but sometimes gets stuck on
await writer.write(source);
. Source is the result of
await Deno.readFile(path)
.

The big problem is that there is no error, the writer.write() promise is just never resolved. So I have no idea how to debug, catch errors or even cancel this after timeout or something.

I can process a couple of files (all with a new
Deno.Command
) but then after a few files it gets stuck and the promise never resolves.

Any ideas how to begin solving what the problem is.

    const cmd = new Deno.Command(this.vipspath + this.vipsthumbnail, {
      args: args,
      stdin: "piped",
      stderr: "piped",
      stdout: "piped",
    }).spawn();

    const writer = cmd.stdin.getWriter();
    console.log("START WRITING", typeof source, source.byteLength);
    await writer.write(source); // <--- STUCK HERE MAY NEVER RESOLVE
    console.log("YAY! WE GOT HERE");
    await writer.ready;
    await writer.close();
Was this page helpful?
await writer.write(buffer) never resolves on Deno.Command - Deno