This is the mail archive of the
cygwin
mailing list for the Cygwin project.
sh.exe hangs when invoked from make without a terminal
- From: Stephen Bennett <sbennett at accelrys dot com>
- To: cygwin at cygwin dot com
- Date: Fri, 21 Dec 2007 15:38:28 +0000
- Subject: sh.exe hangs when invoked from make without a terminal
test.pl:
----
$childpid=fork;
die "failed to fork" if (!defined $childpid);
if (! $childpid) {
close STDIN;
close STDOUT;
close STDERR;
exec "make -f test.mk &>test.out";
}
----
test.mk:
----
var=$(shell echo foobar | cat)
default:
@echo "$(var)"
----
Running "make -f test.mk" from a terminal works as expected -- "foobar" is
echoed. Running test.pl, however, causes the sh.exe process to hang
apparently indefinitely -- the first time I observed this was in an
overnight cronjob, and `sh -c "echo xml4csrc2_2_0 |tr 'a-z' 'A-Z'"` had
been running for approximately 11 hours.
The trigger appears to be the combination of make, the pipeline appearing
in the shell command, and not being attached to a terminal. If I remove
any of these factors (by removing the '| cat', changing 'make -f test.mk'
into 'sh -c "echo foo | cat"', or running "make -f test.mk" from a
terminal), the problem does not manifest itself and everything behaves as
expected. I've so far managed to reproduce the problem on three different
machines with versions 3.1.17 and 3.2.25 of bash, and versions 1.5.24-2
and 1.5.25-7 of the cygwin DLL.
Any suggestions?
Accelrys Limited (http://www.accelrys.com)
Registered office: 334 Cambridge Science Park, Cambridge, CB4 0WN, UK
Registered in England: 2326316
--
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Problem reports: http://cygwin.com/problems.html
Documentation: http://cygwin.com/docs.html
FAQ: http://cygwin.com/faq/