chiark / gitweb /
break out shell_cmd
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Wed, 11 Sep 2013 23:09:25 +0000 (00:09 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Wed, 11 Sep 2013 23:09:25 +0000 (00:09 +0100)
dgit

diff --git a/dgit b/dgit
index f77d349..9768fe9 100755 (executable)
--- a/dgit
+++ b/dgit
@@ -209,6 +209,11 @@ sub runcmd_ordryrun {
     }
 }
 
+sub shell_cmd {
+    my ($first_shell, @cmd) = @_;
+    return qw(sh -ec), $first_shell.'; exec "$@"', 'x', @cmd;
+}
+
 our $helpmsg = <<END;
 main usages:
   dgit [dgit-opts] clone [dgit-opts] package [suite] [./dir|/dir]
@@ -660,8 +665,7 @@ sub ensure_we_have_orig () {
        $origurl .= "/$f";
        die "$f ?" unless $f =~ m/^${package}_/;
        die "$f ?" if $f =~ m#/#;
-       runcmd_ordryrun qw(sh -ec),'cd ..; exec "$@"','x',
-           @dget,'--',$origurl;
+       runcmd_ordryrun shell_cmd 'cd ..', @dget,'--',$origurl;
     }
 }