boklm pushed to branch main at The Tor Project / Applications / RBM
Commits:
-
efd874ab
by Nicolas Vigier at 2024-02-08T13:13:58+01:00
3 changed files:
Changes:
... | ... | @@ -10,7 +10,6 @@ use YAML::XS qw(LoadFile); |
10 | 10 | use Template;
|
11 | 11 | use File::Basename;
|
12 | 12 | use IO::Handle;
|
13 | -use Capture::Tiny qw(capture);
|
|
14 | 13 | use File::Temp;
|
15 | 14 | use File::Copy;
|
16 | 15 | use File::Copy::Recursive qw(fcopy);
|
... | ... | @@ -18,6 +17,7 @@ use File::Path qw(make_path); |
18 | 17 | use File::Basename;
|
19 | 18 | use String::ShellQuote;
|
20 | 19 | use Sort::Versions;
|
20 | +use RBM::CaptureExec qw(capture_exec);
|
|
21 | 21 | use RBM::DefaultConfig;
|
22 | 22 | use Digest::SHA qw(sha256_hex);
|
23 | 23 | use Data::UUID;
|
... | ... | @@ -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 capture_exec);
|
|
32 | + our @EXPORT = qw(exit_error);
|
|
33 | 33 | }
|
34 | 34 | |
35 | 35 | our $config;
|
... | ... | @@ -308,15 +308,6 @@ 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 | - |
|
320 | 311 | sub set_git_gpg_wrapper {
|
321 | 312 | my ($project) = @_;
|
322 | 313 | my $w = project_config($project, 'gpg_wrapper');
|
1 | +package RBM::CaptureExec;
|
|
2 | + |
|
3 | +use Capture::Tiny qw(capture);
|
|
4 | + |
|
5 | +BEGIN {
|
|
6 | + require Exporter;
|
|
7 | + our @ISA = qw(Exporter);
|
|
8 | + our @EXPORT = qw(capture_exec);
|
|
9 | + our @EXPORT_OK = qw(capture_exec);
|
|
10 | +}
|
|
11 | + |
|
12 | +sub capture_exec {
|
|
13 | + my @cmd = @_;
|
|
14 | + my ($stdout, $stderr, $exit) = capture {
|
|
15 | + system(@cmd);
|
|
16 | + };
|
|
17 | + return ($stdout, $stderr, $exit == 0, $exit) if wantarray();
|
|
18 | + return $stdout;
|
|
19 | +}
|
|
20 | + |
|
21 | +1; |
... | ... | @@ -10,7 +10,8 @@ BEGIN { |
10 | 10 | }
|
11 | 11 | |
12 | 12 | use File::Basename;
|
13 | -use RBM qw(capture_exec);
|
|
13 | +use RBM;
|
|
14 | +use RBM::CaptureExec qw(capture_exec);
|
|
14 | 15 | use Cwd qw(getcwd);
|
15 | 16 | use File::Temp;
|
16 | 17 | use File::Path qw(make_path);
|