dspinellis / dgsh

Shell supporting pipelines to and from multiple processes
http://www.spinellis.gr/sw/dgsh/
Other
323 stars 23 forks source link

legacy pipelines ending in "|while read" timeout #64

Closed abliss closed 7 years ago

abliss commented 7 years ago
abliss@localhost:~$ /bin/echo -e "foo\nbar" |while read X; do echo $X; done
9401 dgsh: timeout for negotiation. Exit.
mfragkoulis commented 7 years ago

We are working on a fix for this.

cinterloper commented 7 years ago

this also happens when piping to any bash builtin (for example, a new builtin loaded with enable)

mfragkoulis commented 7 years ago

Thank you for reporting this! Can you please provide a reproducible example?

mfragkoulis commented 7 years ago

According to the description of this issue, it has been resolved. Regarding piping to a bash builtin, I opened issue #72.

cinterloper commented 7 years ago

this will take a bit of explaining, but ill try and cut to the chase https://github.com/masterkorp/LuaBash this is a bash builtin that embeds a lua runtime in your bash enviornment it exposes a lua api to register new bash builtins

root@unit01:/home/g# cat echo.lua && echo

function l_echo()
  for line in io.lines() do
    print(line)
  done
end

bash.register("l_echo")
root@unit01:/home/g# type luabash
luabash is a shell builtin
root@unit01:/home/g# luabash
lua bash wrapper 0.0.3 (C) 2006 - 2009 Valentin Ziegler & Rene Rebe
usage:
    init
    load <lua chunk>
    call <lua function> [arguments]
root@unit01:/home/g# luabash load echo.lua
root@unit01:/home/g# ls / | l_echo
bin
boot
...

in dgsh it appears to load fine, however

root@unit01:/home/g# dgsh
root@unit01:/home/g# ps aux | grep  $$
root        36  0.0  0.0  18464  2480 pts/20   S    00:06   0:00 dgsh
...
root@unit01:/home/g# source /opt/luabash.bashrc
root@unit01:/home/g# type luabash
luabash is a shell builtin
root@unit01:/home/g# luabash load echo.lua
root@unit01:/home/g# type l_echo
l_echo is a function
l_echo ()
{
    luabash call l_echo $@
}
root@unit01:/home/g# ls / | l_echo
46 dgsh: timeout for negotiation. Exit.