Skip to content
This repository has been archived by the owner on Jun 26, 2018. It is now read-only.

Commit

Permalink
Limit changing directories to only the run command.
Browse files Browse the repository at this point in the history
This should reduce problems when using this module in more than one thread.
  • Loading branch information
nicqrocks committed Apr 27, 2017
1 parent 8013735 commit bdca0de
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions lib/Git/Wrapper.pm6
Expand Up @@ -14,16 +14,14 @@ class Git::Wrapper {

method run($subcommand, *@positionals, *%named) {
my $old-dir = $*CWD;
chdir($.gitdir);
my @optstr = map -> $k,$v {
$v eqv Bool::True
?? do { $k.chars > 1 ?? "--$k" !! "-$k" }
!! "--$k=$v"
}, %named.kv;
@positionals.unshift(|@optstr) if ?@optstr;
my $p = run :out, :err, $.git-executable, $subcommand, |@positionals;
my $p = run :out, :err, :cwd($.gitdir), $.git-executable, $subcommand, |@positionals;
my @out = $p.out.slurp-rest;
chdir($old-dir);
return @out;
}

Expand Down

0 comments on commit bdca0de

Please sign in to comment.