You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello! I'm trying to write a script that calls a certain shell script, and then does some more stuff. This shell scripts gives a progress bar, so I need to pipe stdout to Deno in order to see it. The problem I'm having is that after the execution of the script, any call to console.log fails.
I've tried to narrow down the problem to it's minimal, here it is:
deno run -A https://gist.githubusercontent.com/DanielRamosAcosta/e34f917105fa9b5b28f5b105adb29c82/raw/aa139c89621b2f3c300b71dae3a43656e2ab9273/test.ts
Output:
error: Uncaught (in promise) BadResource: Bad resource ID
console.log("Success!");
^
at Object.print (ext:core/01_core.js:628:28)
at Console.<anonymous> (ext:runtime/98_global_scope_shared.js:132:46)
at console.log (ext:deno_console/01_console.js:3098:20)
at https://gist.githubusercontent.com/DanielRamosAcosta/e34f917105fa9b5b28f5b105adb29c82/raw/aa139c89621b2f3c300b71dae3a43656e2ab9273/test.ts:13:11
at eventLoopTick (ext:core/01_core.js:168:7)
console.log can not write to stdout, because you closed stdout in your pipeTo call.
By default ReadableStream#pipeTo closes the target WritableStream when the piped readable stream is closed. You can change this behaviour by passing the preventClose flag to the pipeTo operation. This will cause the writable stream to not be closed when the readable stream finishes:
Bit of a footgun, innit. Wouldn't have found a solution were it not for this ticket - thanks @lucacasonato!
Is it possible to add an error message notifying the user that they're "using stdout/stderr wrong", i.e. that the stream has been closed by the previous call to pipeTo? Even though there's a stack trace, "Bad resource ID" sounds like it could be anything.
Hello! I'm trying to write a script that calls a certain shell script, and then does some more stuff. This shell scripts gives a progress bar, so I need to pipe stdout to Deno in order to see it. The problem I'm having is that after the execution of the script, any call to
console.log
fails.I've tried to narrow down the problem to it's minimal, here it is:
to try it:
Output:
Version:
The text was updated successfully, but these errors were encountered: