const shellCmd = new Deno.Command("/bin/sh", {
    stdin: "piped",
    stdout: "piped",
    stderr: "piped",
});

const shell = shellCmd.spawn();

const writer = shell.stdin.getWriter();
const stdoutR = shell.stdout.pipeThrough(new TextDecoderStream()).getReader();
const stderrR = shell.stderr.pipeThrough(new TextDecoderStream()).getReader();

const encode = new TextEncoder();
//
//await writer.write(encode.encode("usbip list -l\n"));
//
//const value = await stdoutR.read();
//
//await stdoutR.cancel();
//
//console.log(value);

await writer.write(encode.encode("usbip port\n"));

while (true) {
    const { value, done } = stderrR.read();
}

shell.kill("SIGTERM");
