Skip to content

Proper way to write to FD 3 (on Windows)? #6305

@TooTallNate

Description

@TooTallNate

I'm trying to have deno output some information to file descriptor 3, so I am spawning deno like so:

$ deno run example.ts 3>three.txt

I have it working as expected by using /dev/fd/3:

const fd = Deno.openSync('/dev/fd/3', { read: false, write: true });
Deno.writeAllSync(fd, new TextEncoder().encode('hello'));
Deno.close(fd.rid);

Ok fine, good. But what I am really interested is learning the proper way to do this in a cross-platform way that will work on Windows.

Thanks in advance!

Metadata

Metadata

Assignees

No one assigned

    Labels

    clirelated to cli/ dirsuggestionsuggestions for new features (yet to be agreed)

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions