sync with OpenBSD -current
This commit is contained in:
parent
00180dc79b
commit
074e641852
75 changed files with 2693 additions and 2103 deletions
|
@ -1,5 +1,5 @@
|
|||
# ex:ts=8 sw=4:
|
||||
# $OpenBSD: Log.pm,v 1.10 2023/06/13 09:07:17 espie Exp $
|
||||
# $OpenBSD: Log.pm,v 1.11 2024/10/01 18:48:29 tb Exp $
|
||||
#
|
||||
# Copyright (c) 2007-2010 Marc Espie <espie@openbsd.org>
|
||||
#
|
||||
|
@ -104,7 +104,24 @@ sub fatal($self, @p)
|
|||
|
||||
sub system($self, @p)
|
||||
{
|
||||
if (open(my $grab, "-|", @p)) {
|
||||
my ($todo, $todo2);
|
||||
if (ref $p[0] eq 'CODE') {
|
||||
$todo = shift @p;
|
||||
} else {
|
||||
$todo = sub() {};
|
||||
}
|
||||
if (ref $p[0] eq 'CODE') {
|
||||
$todo2 = shift @p;
|
||||
} else {
|
||||
$todo2 = sub() {};
|
||||
}
|
||||
my $child_pid = open(my $grab, "-|");
|
||||
if (!defined $child_pid) {
|
||||
$self->{p}->say("system(#1) was not run: #2 #3",
|
||||
join(", ", @p), $!, $self->{p}->child_error);
|
||||
}
|
||||
if ($child_pid) {
|
||||
&$todo2();
|
||||
while (<$grab>) {
|
||||
$self->{p}->_print($_);
|
||||
}
|
||||
|
@ -115,8 +132,9 @@ sub system($self, @p)
|
|||
}
|
||||
return $?;
|
||||
} else {
|
||||
$self->{p}->say("system(#1) was not run: #2 #3",
|
||||
join(", ", @p), $!, $self->{p}->child_error);
|
||||
$DB::inhibit_exit = 0;
|
||||
&$todo();
|
||||
exec {$p[0]} (@p) or exit 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue