redirect stderr of dpkg --version to /dev/null to prevent error output if dpkg is too old (thanks Trent W. Buck!)
This commit is contained in:
parent
e4a3d2b2c5
commit
65e40c8c34
1 changed files with 8 additions and 2 deletions
10
mmdebstrap
10
mmdebstrap
|
@ -1289,8 +1289,14 @@ sub run_setup() {
|
||||||
|
|
||||||
my $dpkgversion;
|
my $dpkgversion;
|
||||||
{
|
{
|
||||||
open my $fh, '-|', 'dpkg', '--robot',
|
my $pid = open my $fh, '-|' // error "failed to fork(): $!";
|
||||||
'--version' // error "failed to fork(): $!";
|
if ($pid == 0) {
|
||||||
|
# redirect stderr to /dev/null to hide error messages from dpkg
|
||||||
|
# versions before 1.20.0
|
||||||
|
open(STDERR, '>', '/dev/null')
|
||||||
|
or error "cannot open /dev/null for writing: $!";
|
||||||
|
exec 'dpkg', '--robot', '--version';
|
||||||
|
}
|
||||||
chomp(
|
chomp(
|
||||||
$dpkgversion = do { local $/; <$fh> }
|
$dpkgversion = do { local $/; <$fh> }
|
||||||
);
|
);
|
||||||
|
|
Loading…
Reference in a new issue