Child process hangs waiting for EOF (end fo file) when using stdin(Command.PIPED)
#1463
Labels
bug
Something isn't working
stdin(Command.PIPED)
#1463
What system are you running Yazi on?
Linux X11
What terminal are you running Yazi in?
kitty 0.35.2
yazi --debug
outputDid you try the latest nightly build to see if the problem got fixed?
Yes, and I updated the debug information above (
yazi --debug
) to the nightly that I triedDescribe the bug
When setting the stdin of a child process to be piped and spawning it (e.g.
Command('rev'):stdin(Command.PIPED):spawn()
) I can write to its input, but then process never completes. The task manager shows that the process is still open, it just has not exit and there's no error (even on the logs):Minimal reproducer
Plugin at
~/.config/yazi/plugins/repro.yazi/init.lua
Keymap:
Anything else?
The example from the documentation works as expected, so I suspected that maybe what is causing the problem is that stdin is not being closed, thus the process doesn't reach the EOF and it just hangs there waiting for more data. The example from the docs works because as soon as
echo
exits, its stdout stream is closed and the piped stdin ofrev
reaches the EOF.I try searching in the docs if there's a
Child:close()
method to manually close stdin but it seems that this functionality doesn't exists (even though there'swrite_all
andflush
methods). Maybe provide aclose()
method to close stdin so the child process can reach the EOF?The text was updated successfully, but these errors were encountered: