From 921e9a76f1ca47d30d765f2f2bf61954e8ac9c9c Mon Sep 17 00:00:00 2001 From: Slack Coder Date: Tue, 21 Jan 2025 16:11:42 -0500 Subject: Avoid requiring root access Make temporary folder generation lazy to postpone requiring root access until needed. --- SBO-Lib/lib/SBO/Lib/Build.pm | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) (limited to 'SBO-Lib/lib/SBO/Lib/Build.pm') diff --git a/SBO-Lib/lib/SBO/Lib/Build.pm b/SBO-Lib/lib/SBO/Lib/Build.pm index e6aa66b..ad760b7 100644 --- a/SBO-Lib/lib/SBO/Lib/Build.pm +++ b/SBO-Lib/lib/SBO/Lib/Build.pm @@ -37,7 +37,6 @@ our @EXPORT_OK = qw{ rewrite_slackbuild run_tee - $tempdir $tmpd $env_tmp }; @@ -71,11 +70,6 @@ set. Will be the same as C<$TMP> if it is set, otherwise it will be C. -=head2 $tempdir - -This is a temporary directory created for sbotools' use, and it should be -cleaned up when sbotools exits. - =cut # get $TMP from the env, if defined - we use two variables here because there @@ -85,8 +79,6 @@ our $env_tmp = $ENV{TMP}; our $tmpd = $env_tmp ? $env_tmp : '/tmp/SBo'; make_path($tmpd) unless -d $tmpd; -our $tempdir = tempdir(CLEANUP => 1, DIR => $tmpd); - =head1 SUBROUTINES =cut @@ -729,6 +721,8 @@ output will be C and the exit status will hold a true value. sub run_tee { my $cmd = shift; + my $tempdir = tempdir(CLEANUP => 1, DIR => $tmpd); + my $out_fh = tempfile(DIR => $tempdir); my $out_fn = get_tmp_extfn($out_fh); return undef, _ERR_F_SETFD if not defined $out_fn; -- cgit v1.2.3