A
lgorithmique
N
umérique
D
istribuée
Public GIT Repository
projects
/
simgrid.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
[tesh] cleanup: don't start useless process instead of killing it right away
[simgrid.git]
/
tools
/
tesh
/
tesh.pl
diff --git
a/tools/tesh/tesh.pl
b/tools/tesh/tesh.pl
index
48f5d1c
..
d67fe47
100755
(executable)
--- a/
tools/tesh/tesh.pl
+++ b/
tools/tesh/tesh.pl
@@
-290,7
+290,7
@@
sub exec_cmd {
close CHILD_IN;
# if timeout specified, fork and kill executing child at the end of timeout
close CHILD_IN;
# if timeout specified, fork and kill executing child at the end of timeout
- if (
defined($cmd{'timeout'}) or defined($opts{'timeout'}
)){
+ if (
not $cmd{'background'} and (defined($cmd{'timeout'}) or defined($opts{'timeout'})
)){
$time_to_wait= defined($cmd{'timeout'}) ? $cmd{'timeout'} : $opts{'timeout'};
$forked = fork();
$timeout=-1;
$time_to_wait= defined($cmd{'timeout'}) ? $cmd{'timeout'} : $opts{'timeout'};
$forked = fork();
$timeout=-1;
@@
-302,19
+302,13
@@
sub exec_cmd {
# Cleanup the executing child, and kill the timeouter brother on need
$cmd{'return'} = 0 unless defined($cmd{'return'});
# Cleanup the executing child, and kill the timeouter brother on need
$cmd{'return'} = 0 unless defined($cmd{'return'});
- if
($cmd{'background'} != 1)
{
+ if
($cmd{'background'} != 1)
{
waitpid ($cmd{'pid'}, 0);
$cmd{'gotret'} = exit_status($?);
parse_out(\%cmd);
waitpid ($cmd{'pid'}, 0);
$cmd{'gotret'} = exit_status($?);
parse_out(\%cmd);
- }
else
{
+ }
else
{
# & commands, which will be handled at the end
push @bg_cmds, \%cmd;
# & commands, which will be handled at the end
push @bg_cmds, \%cmd;
- # no timeout for background commands
- if($forked){
- kill(SIGKILL, $forked);
- $timeout=0;
- $forked=0;
- }
}
}
}
}
@@
-627,7
+621,7
@@
print "hey\n";
die "[TESH/CRITICAL] parse error: $line\n";
}
if($forked){
die "[TESH/CRITICAL] parse error: $line\n";
}
if($forked){
- kill(
SIGKILL
, $forked);
+ kill(
'KILL'
, $forked);
$timeout=0;
}
$timeout=0;
}
@@
-643,7
+637,7
@@
if (defined($cmd{'cmd'})) {
if($forked){
if($forked){
- kill(
SIGKILL
, $forked);
+ kill(
'KILL'
, $forked);
$timeout=0;
}
$timeout=0;
}