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
constproc=Bun.spawn({cmd: ['./test'],stdout: 'pipe',});console.log('pid is ',proc.pid);proc.exited.then(code=>{console.log('exited with code',code);});(async()=>{constreader=proc.stdout.getReader();constdecoder=newTextDecoder();while(true){const{ done, value }=awaitreader.read();if(done){break;}console.log({chunk: decoder.decode(value)});}})();setTimeout(()=>{proc.kill();},1000);// adjust the timer here, it hangs on 1000 and runs fine on 3000
How often does it reproduce? Is there a required condition?
every time as long as either [proc.kill() is run OR the process is killed by other means], BEFORE the process exits and flushes stdout.
What is the expected behavior?
bun was expected to not stay open forever.
What do you see instead?
no data read for a second, then the process is killed and bun stays open forever. other event loop stuff like a setInterval() works fine but the process is forever open, the call to .read() never resolves.
This was discovered while trying to use Bun to run Blackmagic Fusion Studio's fuscript binary. As of Fusion 18.1 this executable does not buffer its logs making it unreadable by any program that you try and pipe it's stdout to. So even if this gets fixed I'm still stuck in that regard.
The text was updated successfully, but these errors were encountered:
What version of Bun is running?
latest 0.2.3, as well as compiled from af971f6
What platform is your computer?
Linux 6.0.7-arch1-1 #1 SMP PREEMPT_DYNAMIC Thu, 03 Nov 2022 18:01:58 +0000 x86_64 unknown
What steps can reproduce the bug?
Compile this binary with
gcc
orclang
gcc test.c -o test
Run it with bun
How often does it reproduce? Is there a required condition?
every time as long as either [
proc.kill()
is run OR the process is killed by other means], BEFORE the process exits and flushes stdout.What is the expected behavior?
bun was expected to not stay open forever.
What do you see instead?
no data read for a second, then the process is killed and bun stays open forever. other event loop stuff like a setInterval() works fine but the process is forever open, the call to
.read()
never resolves.Additional information
Discord conversation: https://discord.com/channels/876711213126520882/1005604764224069762/1041140955111247913
This was discovered while trying to use Bun to run Blackmagic Fusion Studio's
fuscript
binary. As of Fusion 18.1 this executable does not buffer its logs making it unreadable by any program that you try and pipe it's stdout to. So even if this gets fixed I'm still stuck in that regard.The text was updated successfully, but these errors were encountered: