richard pushed to branch main at The Tor Project / Applications / RBM
Commits:
-
9336d42f
by Nicolas Vigier at 2024-01-25T11:42:58+01:00
2 changed files:
Changes:
... | ... | @@ -10,7 +10,7 @@ use YAML::XS qw(LoadFile); |
10 | 10 | use Template;
|
11 | 11 | use File::Basename;
|
12 | 12 | use IO::Handle;
|
13 | -use IO::CaptureOutput qw(capture_exec);
|
|
13 | +use Capture::Tiny qw(capture);
|
|
14 | 14 | use File::Temp;
|
15 | 15 | use File::Copy;
|
16 | 16 | use File::Copy::Recursive qw(fcopy);
|
... | ... | @@ -29,7 +29,7 @@ use feature "state"; |
29 | 29 | BEGIN {
|
30 | 30 | require Exporter;
|
31 | 31 | our @ISA = qw(Exporter);
|
32 | - our @EXPORT = qw(exit_error);
|
|
32 | + our @EXPORT = qw(exit_error capture_exec);
|
|
33 | 33 | }
|
34 | 34 | |
35 | 35 | our $config;
|
... | ... | @@ -308,6 +308,15 @@ sub exit_error { |
308 | 308 | exit (exists $_[1] ? $_[1] : 1);
|
309 | 309 | }
|
310 | 310 | |
311 | +sub capture_exec {
|
|
312 | + my @cmd = @_;
|
|
313 | + my ($stdout, $stderr, $exit) = capture {
|
|
314 | + system(@cmd);
|
|
315 | + };
|
|
316 | + return ($stdout, $stderr, $exit == 0, $exit) if wantarray();
|
|
317 | + return $stdout;
|
|
318 | +}
|
|
319 | + |
|
311 | 320 | sub set_git_gpg_wrapper {
|
312 | 321 | my ($project) = @_;
|
313 | 322 | my $w = project_config($project, 'gpg_wrapper');
|
... | ... | @@ -10,9 +10,8 @@ BEGIN { |
10 | 10 | }
|
11 | 11 | |
12 | 12 | use File::Basename;
|
13 | -use RBM;
|
|
13 | +use RBM qw(capture_exec);
|
|
14 | 14 | use Cwd qw(getcwd);
|
15 | -use IO::CaptureOutput qw(capture_exec);
|
|
16 | 15 | use File::Temp;
|
17 | 16 | use File::Path qw(make_path);
|
18 | 17 |