bun icon indicating copy to clipboard operation
bun copied to clipboard

piping stdout to stdin doesn't work

Open robobun opened this issue 1 year ago • 2 comments

const adb = Bun.spawn(
  [
    "adb",
    "exec-out",
    "screenrecord",
    "--time-limit=5",
    "--output-format=h264",
    "-",
  ],
  {
    onExit({ exitCode }) {
      console.log("adb exited with code", exitCode);
    },
  }
);

const ffmpeg = Bun.spawn(
  ["ffmpeg", "-i", "-", "-c:v", "copy", "-f", "mp4", "video.mp4"],
  {
    stdin: adb.stdout,
    onExit({ exitCode }) {
      console.log("ffmpeg exited with code", exitCode);
    },
  }
);
const ffmpeg = Bun.spawn(
                    ^
TypeError: Unsupported ReadableStream type
 code: "ERR_INVALID_ARG_TYPE"

Originally reported on Discord: piping stdout to stdin doesn't work

robobun avatar Jan 08 '24 20:01 robobun

this is a crash in debug. i'm going to add a better error in a pr but:

image

paperclover avatar Jan 08 '24 20:01 paperclover

I've run into this one, too: TODOError: Re-enable ReadableStream support in spawn stdin.

brettwillis avatar Jun 11 '25 11:06 brettwillis