diff options
author | Chris Wilson <chris+github@qwirx.com> | 2008-12-05 23:13:38 +0000 |
---|---|---|
committer | Chris Wilson <chris+github@qwirx.com> | 2008-12-05 23:13:38 +0000 |
commit | f3b5f34ade0d2e6bcb5b41dea598d98d690696f9 (patch) | |
tree | 39f4d37c3affbca334b6be1ba54f5994278e8f31 | |
parent | cb4f4aec1752ab80b273ef3b163d82f6775252b2 (diff) |
Simplify code for killing old fart processes on Windows/Cygwin
and make it actually work at the end of the test. man kill for
why we use /bin/kill instead of just kill on cygwin.
-rwxr-xr-x | infrastructure/makebuildenv.pl.in | 45 |
1 files changed, 26 insertions, 19 deletions
diff --git a/infrastructure/makebuildenv.pl.in b/infrastructure/makebuildenv.pl.in index 291e479d..15e15dac 100755 --- a/infrastructure/makebuildenv.pl.in +++ b/infrastructure/makebuildenv.pl.in @@ -400,22 +400,35 @@ for my $mod (@implicit_deps, @modules) "test script file for $module for writing\n"; print TESTFILE "#!/bin/sh\necho TEST: $module\n"; - if (-d "$module/testfiles") + if ($target_windows) { - if ($target_windows) - { print TESTFILE <<__E; -echo Killing any running daemons... -test -r testfiles/bbackupd.pid && /bin/kill -f `cat testfiles/bbackupd.pid` -test -r testfiles/bbstored.pid && /bin/kill -f `cat testfiles/bbstored.pid` +kill_process() +{ + test -r testfiles/$1.pid \ + && /bin/kill -0 -f `cat testfiles/$1.pid` \ + && /bin/kill -f `cat testfiles/$1.pid` +} __E } else { print TESTFILE <<__E; +kill_process() +{ + test -r testfiles/$1.pid \ + && kill -0 `cat testfiles/$1.pid` \ + && kill `cat testfiles/$1.pid` +} +__E + } + + if (-d "$module/testfiles") + { + print TESTFILE <<__E; echo Killing any running daemons... -test -r testfiles/bbackupd.pid && kill `cat testfiles/bbackupd.pid` -test -r testfiles/bbstored.pid && kill `cat testfiles/bbstored.pid` +kill_process bbackupd +kill_process bbstored __E } @@ -430,7 +443,7 @@ cp -p -R ../../../$module/testfiles . __E } - if(-e "$module/testextra") + if (-e "$module/testextra") { open FL,"$module/testextra" or die "Can't open $module/testextra"; @@ -440,18 +453,12 @@ __E print TESTFILE "$runcmd\n"; - if(-d "$module/testfiles") + if (-d "$module/testfiles") { print TESTFILE <<__E; - -# echo Killing any running daemons... -test -r testfiles/bbackupd.pid \\ -&& kill -0 `cat testfiles/bbackupd.pid` \\ -&& kill `cat testfiles/bbackupd.pid` - -test -r testfiles/bbstored.pid \\ -&& kill -0 `cat testfiles/bbstored.pid` \\ -&& kill `cat testfiles/bbstored.pid` +echo Killing any running daemons... +kill_process bbackupd +kill_process bbstored __E } |