chiark / gitweb /
getcwd: Introduce must_getcwd using getcwd rather than cmdoutput
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 3 Aug 2014 16:09:43 +0000 (17:09 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 3 Aug 2014 16:09:43 +0000 (17:09 +0100)
dgit

diff --git a/dgit b/dgit
index 6369856c4d77d498814e4a0237b6738d1795903c..86613399893cb7915bd9427ff4f70cc874a67909 100755 (executable)
--- a/dgit
+++ b/dgit
@@ -623,6 +623,12 @@ sub git_get_ref ($) {
     }
 }
 
     }
 }
 
+sub must_getcwd () {
+    my $d = getcwd();
+    defined $d or fail "getcwd failed: $!";
+    return $d;
+}
+
 our %rmad;
 
 sub archive_query ($) {
 our %rmad;
 
 sub archive_query ($) {
@@ -1915,7 +1921,7 @@ sub build_source {
        runcmd_ordryrun_local (@dpkgbuildpackage, qw(-us -uc -S)),
            changesopts();
     } else {
        runcmd_ordryrun_local (@dpkgbuildpackage, qw(-us -uc -S)),
            changesopts();
     } else {
-       my $pwd = cmdoutput qw(env - pwd);
+       my $pwd = must_getcwd();
        my $leafdir = basename $pwd;
        changedir "..";
        runcmd_ordryrun_local @dpkgsource, qw(-b --), $leafdir;
        my $leafdir = basename $pwd;
        changedir "..";
        runcmd_ordryrun_local @dpkgsource, qw(-b --), $leafdir;