How to cancel or abort .pipeTo()?
I prefer not asking, but after I found (what I consider) an MDN easter egg, I realized this is probably not something I'm going to solve without help from runtime-implementers. https://user-images.githubusercontent.com/17692058/200146738-da3e8747-6c7f-4ec7-adb8-fbb8c8947d33.png
The example is straightforward, call
stream1.pipeTo(stream2)
then, with full access to both stream1
and stream2
try to shutdown/cancel/close/abort/sabotage/nuke stream1, stream2 or even just the pipe itself (copy-paste example below). The big issue is that, because of the pipeTo
the deno process never ends. I've tried absolutely everything I can think of, including inheriting from WritableStream, prototype pollution hacks, accessing probably-shouldnt-be-accessed-directly-symbol keys, etc and I've not got a hint of success
2 Replies
have you tried passing an
AbortSignal
as the signal
parameter in the second parameter to pipeTo
?stream1
is Deno.stdin, the behavior is probably still not what you're looking for.
I took a look at MDN, can't say I fully understand AbortControllers, but I feel like the last attempt should've worked
Although I didn't solve the problem, I did figure out what is going on. I believe its an issue that .read()
from stdin doesnt truly abort. I'll create an issue for it