parallel: exec sleep does not work on CygWin.

This commit is contained in:
Ole Tange 2017-05-21 21:02:12 +02:00
parent dd25255ca8
commit e06ab693b3

View file

@ -1376,7 +1376,7 @@ sub check_invalid_option_combinations {
sub init_globals { sub init_globals {
# Defaults: # Defaults:
$Global::version = 20170515; $Global::version = 20170522;
$Global::progname = 'parallel'; $Global::progname = 'parallel';
$Global::infinity = 2**31; $Global::infinity = 2**31;
$Global::debug = 0; $Global::debug = 0;
@ -5513,8 +5513,13 @@ sub compute_number_of_processes {
# The child takes one process slot # The child takes one process slot
# It will be killed later # It will be killed later
$SIG{'TERM'} = $Global::original_sig{'TERM'}; $SIG{'TERM'} = $Global::original_sig{'TERM'};
if($^O eq "cygwin") {
# The exec does not work on Cygwin
sleep 10101010;
} else {
# 'exec sleep' takes less RAM than sleeping in perl # 'exec sleep' takes less RAM than sleeping in perl
exec 'sleep', 10101; exec 'sleep', 10101;
}
exit(0); exit(0);
} else { } else {
# Failed to spawn # Failed to spawn