From 07f639c9219968a01d5c722424e9c61d3b146014 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Wed, 25 Oct 2023 00:29:25 +0000 Subject: spawn: support synchronous run_qx This is similar to `backtick` but supports all our existing spawn functionality (chdir, env, rlimit, redirects, etc.). It also supports SCALAR ref redirects like run_script in our test suite for std{in,out,err}. We can probably use :utf8 by default for these redirects, even. --- lib/PublicInbox/Git.pm | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'lib/PublicInbox/Git.pm') diff --git a/lib/PublicInbox/Git.pm b/lib/PublicInbox/Git.pm index a460d155..476dcf30 100644 --- a/lib/PublicInbox/Git.pm +++ b/lib/PublicInbox/Git.pm @@ -69,6 +69,7 @@ sub check_git_exe () { $GIT_VER = eval("v$1") // die "BUG: bad vstring: $1 ($v)"; $EXE_ST = $st; } + $GIT_EXE; } sub git_version { @@ -422,6 +423,11 @@ sub async_err ($$$$$) { $async_warn ? carp($msg) : $self->fail($msg); } +sub cmd { + my $self = shift; + [ $GIT_EXE // check_git_exe(), "--git-dir=$self->{git_dir}", @_ ] +} + # $git->popen(qw(show f00)); # or # $git->popen(qw(show f00), { GIT_CONFIG => ... }, { 2 => ... }); sub popen { -- cgit v1.2.3-24-ge0c7