This is the mail archive of the cygwin mailing list for the Cygwin project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

sh.exe hangs when invoked from make without a terminal
die "failed to fork" if (!defined $childpid);
if (! $childpid) {
    close STDIN;
    close STDOUT;
    close STDERR;
    exec "make -f &>test.out";
var=$(shell echo foobar | cat)
        @echo "$(var)"

Running "make -f" from a terminal works as expected -- "foobar" is 
echoed. Running, 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' 
into 'sh -c "echo foo | cat"', or running "make -f" 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 (
Registered office: 334 Cambridge Science Park, Cambridge, CB4 0WN, UK
Registered in England: 2326316

Unsubscribe info:
Problem reports:

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]