From 5f4056722f237fb55da3cdc47fbfb045ad480170 Mon Sep 17 00:00:00 2001 From: Pascal Terjan Date: Mon, 5 Mar 2012 20:27:05 +0000 Subject: Fork to wait for the build to finish, then immediately collect results --- ulri | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/ulri b/ulri index f4467bf..b9a35f7 100755 --- a/ulri +++ b/ulri @@ -715,7 +715,21 @@ foreach my $prefix (sort keys %pkg_tree) { "$lock_arch.$bot.$host.$fulldate.$pid.lock"; plog('DEBUG', "create lock $lock_file"); create_file($lock_file, "$program_name $$", time()); - + + # Fork to wait for the build to finish + if ((my $fpid = fork()) == 0) { + local $SIG{ALRM} = sub { + # Run ourselves to kill the build + exec "ulri"; + }; + alarm $config->{faildelay}; + # SSH to $host and wait up for $pid to exit + ssh($remote, "'while /bin/true; do ps $pid >/dev/null 2>&1 || exit; sleep 1; done'"); + alarm 0; + # Fetch build results + exec "ulri"; + } + last; } last if $compildone->{$prefix}{$media}{$arch}; -- cgit v1.2.1