diff options
author | Ian Jackson <ijackson@chiark.greenend.org.uk> | 2016-07-16 23:35:21 +0100 |
---|---|---|
committer | Ian Jackson <ijackson@chiark.greenend.org.uk> | 2016-07-17 13:46:14 +0100 |
commit | 6bce7517ee43b52e0a23c74dec8f5d0bcb7d0668 (patch) | |
tree | 63066c06c5c8ecea1f5ea0235577a0490e956b16 | |
parent | 1be66e47fb2675f35f301e5e0f7e9e66e70d2437 (diff) |
Subprocess error handling: Fix when divert check fails
If the remote command failed, do not try to match the undef value
against the various regexps.
-rwxr-xr-x | dgit | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -1160,7 +1160,7 @@ sub check_for_git () { " set -e; cd ".access_cfg('git-path').";". " if test -d $package.git; then echo 1; else echo 0; fi"); my $r= cmdoutput @cmd; - if ($r =~ m/^divert (\w+)$/) { + if (defined $r and $r =~ m/^divert (\w+)$/) { my $divert=$1; my ($usedistro,) = access_distros(); # NB that if we are pushing, $usedistro will be $distro/push @@ -1169,7 +1169,7 @@ sub check_for_git () { progress "diverting to $divert (using config for $instead_distro)"; return check_for_git(); } - failedcmd @cmd unless $r =~ m/^[01]$/; + failedcmd @cmd unless defined $r and $r =~ m/^[01]$/; return $r+0; } elsif ($how eq 'url') { my $prefix = access_cfg('git-check-url','git-url'); |