[Nix-dev] [PATCH] Make `build-remote.pl' work with GNU lshd

Ludovic Courtès ludovic.courtes at inria.fr
Fri Dec 9 11:21:42 CET 2011


Hello!

When the SSH server is GNU lshd, build-remote.pl wouldn’t terminate
because the stdin of the subshell that calls ‘read’ would never be
closed:

  $ ssh OPENSSH-HOST '( read ; kill -INT -$$ )<&0 & echo hey' ; echo $?
  hey
  0

  $ ssh LSHD-HOST '( read ; kill -INT -$$ )<&0 & echo hey' ; echo $?
  hey
  [sits there until you hit RET]
  0

(The behavior of lshd seems OK to me since the subshell gets a copy of
the parent shell’s stdin, so closing one shouldn’t close the other.)

So I’ve tried this replacement using ‘trap’, which seems to work well
for me:

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: text/x-patch
Size: 933 bytes
Desc: not available
Url : http://lists.science.uu.nl/pipermail/nix-dev/attachments/20111209/80c31d94/attachment.bin 
-------------- next part --------------

What do you think?

Thanks,
Ludo’.


More information about the nix-dev mailing list