chiark / gitweb /
test: Fix fd plumbing
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Fri, 11 Oct 2019 20:31:44 +0000 (21:31 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sat, 12 Oct 2019 22:29:26 +0000 (23:29 +0100)
commitb7e18338166e99bef38d80c102b99c65d367f369
tree353009b001c885564a1762a33e03763bf74fd593
parent4de4f53e400d704f7969b3db1623cb65a39b7785
test: Fix fd plumbing

In a background process, stdin defaults to /dev/null, so we need to do
a little dance.  <&0 looks like it ought to work according to the bash
manual and does indeed work in bash, but not in dash.  This
construction seems to work in both.

Tested with:
  date | sh -exc 'cat <&0 >t &'

SuS says:
  If job control is disabled (see set, -m), the standard input for an
  asynchronous list, before any explicit redirections are performed,
  shall be considered to be assigned to a file that has the same
  properties as /dev/null. This shall not happen if job control is
  enabled. In all cases, explicit redirection of standard input shall
  override this activity.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
test/invoke