| 1 | package Proc::ShellSpawn::Large; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | 170 | our $VERSION = '0.11'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | # EXPERIMENTAL, awaiting approval: what Proc::ShellSpawn needs to run Proc::ShellSubset::Large trees | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | # (doc/large-subset/large-subset-spec.md, sections 4 and 5), as handlers named in Proc::ShellSpawn's tables: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | # x_NAME(CONTEXT, NODE, TAIL, K) command nodes { func | export | readonly | local | exec => ... } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | # b_NAME(CONTEXT, ARGV, ENV, K, DATA) builtins, and call() for functions | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | # Each calls K exactly once, or ends the shell (Proc::ShellSpawn::leave or Proc::ShellSpawn::fail), and never waits. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | 170 | ▶ | use strict; use warnings; use feature 'current_sub'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | 170 | ▶ | use POSIX (); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | 170 | ▶ | use Scalar::Util qw(weaken); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | 170 | ▶ | use Config (); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | 170 | ▶ | use Proc::ShellSpawn; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | 170 | ▶ | BEGIN { no strict 'refs'; *$_ = \&{"Proc::ShellSpawn::$_"} for qw(defer leave fail msg put var setvar expand_str each_async x_list x_cmd | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | redirect hold release release_ctx release_all find_cmd spawn handler) } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | 170 | our $UNSUPPORTED = 248; # A4: the status when something outside the subset shows up at run time (250 - 2: sh's syntax error status, moved out of the common range; doc/large-subset/large-subset-spec.md, section 5) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | 0 | ▶ | sub unsupported { # A4: something outside the subset, found at run time | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
unsupported: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | 0 | ▶ | my ($c, $what) = @_; put($c, 2, "Proc::ShellSubset::Large: $what is not supported\n", sub { leave($c, $UNSUPPORTED) }) } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | 17 | ▶ | sub run_text { # eval, ., trap actions: parse with the large grammar and run in this shell | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
run_text: called CC=5 SCAR=16.1
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | 17 | my ($c, $text, $what, $k) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | 17 | ▶ | my $sh = $c->{sh}; my $t = $sh->{parse}->($text, %{$sh->{alias}} ? (aliases => { %{$sh->{alias}} }) : (), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | $what =~ /^the text of '\. / ? () : (nolineno => 1)); # the run's own parser; $LINENO in eval or trap text: A4 (G8) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | 17 | ▶ | return unsupported($c, $what) if ref $t ne 'ARRAY'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | 17 | ▶ | return defer($k, 0) unless @$t; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | 14 | ▶ | $sh->{intext}++; x_list($c, $t, undef, sub { $sh->{intext}--; $k->(@_) }) } # alias in this text: B1, A4 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | 0 | ▶ | sub b_unsupported { my ($c, $argv) = @_; unsupported($c, "'$argv->[0]'") } # a builtin left to sh, named at run time | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
b_unsupported: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | 2 | ▶ | sub x_rest { # P1 (post2-0.04): the rest of the text after a line with an alias definition known only when it ran: parsed now, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
x_rest: called CC=4 SCAR=14.2
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | # with the aliases defined by now, as both shells read a text one complete command at a time; a form outside the subset: A4 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | 2 | my ($c, $x, $tail, $k) = @_; my $sh = $c->{sh}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | 2 | ▶ | my $t = $sh->{parse}->($x->{rest}, %{$sh->{alias}} ? (aliases => { %{$sh->{alias}} }) : (), lineoff => $x->{lineoff}); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | 2 | ▶ | return unsupported($c, "a command after an alias definition") if ref $t ne 'ARRAY'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | 2 | ▶ | return defer($k, $sh->{q}) unless @$t; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | 2 | x_list($c, $t, $tail, $k) } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | 5 | ▶ | sub b_late { # 3A (post-0.04): a command whose name the text also defines as a function, which is not defined (yet): | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
b_late: called CC=2 SCAR=7.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | # parsed again from its expanded words, quoted, so that the builtin's own checks apply as they would have at parse time | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | 5 | ▶ | my ($c, $argv, $env, $k) = @_; my $q = sub { (my $w = shift) =~ s/'/'\\''/g; "'$w'" }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | 5 | my $text = join ' ', (map "$_=" . $q->($env->{$_}), sort keys %$env), map $q->($_), @$argv; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | 5 | my $t = $c->{sh}{parse}->($text); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | 5 | ▶ | return unsupported($c, "'$argv->[0]' in this form") if ref $t ne 'ARRAY'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | 5 | x_list($c, $t, undef, $k) } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | # ------------------------------------------------------------------ functions | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | 33 | ▶ | sub x_func { my ($c, $x, $tail, $k) = @_; $c->{sh}{cmd}{$x->{func}} = ['Proc::ShellSpawn::Large::call', $x->{body}]; defer($k, 0) } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
x_func: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | 33 | ▶ | sub call { # NAME ARGS...: the body in this shell, with its own positional parameters and frame | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
call: called CC=3 SCAR=11.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | 33 | my ($c, $argv, $env, $k, $body) = @_; my $sh = $c->{sh}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | 33 | my ($old, %saved) = $sh->{args}; # settings before the call: for its duration, exported (dash) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | 33 | for (sort keys %$env) { $saved{$_} = [exists $sh->{vars}{$_}, $sh->{vars}{$_}, $sh->{exp}{$_}]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | 1 | ▶ | setvar($c, $_, $env->{$_}) or return; $sh->{exp}{$_} = 1 } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | 33 | $sh->{args} = [@$argv[1 .. $#$argv]]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | 33 | my $saved = \%saved; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | 33 | ▶ | my $ret = sub { my $st = shift; restore($sh, $saved); $sh->{args} = $old; defer($k, $st) }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | 33 | x_cmd({ %$c, loops => [], held => 0, frame => { saved => $saved, ret => $ret } }, $body, undef, $ret) } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | 32 | ▶ | sub restore { # put back variables a function changed with local, or settings before its call | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
restore: called CC=4 SCAR=14.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | 32 | my ($sh, $saved) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | 32 | for my $n (keys %$saved) { my ($had, $v, $exp) = @{delete $saved->{$n}}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | 2 | ▶ | if ($had) { $sh->{vars}{$n} = $v } else { delete $sh->{vars}{$n} } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | 0 | ▶ | if ($exp) { $sh->{exp}{$n} = 1 } else { delete $sh->{exp}{$n} } } } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | 3 | ▶ | sub b_return { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
b_return: called CC=4 SCAR=14.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | 3 | ▶ | my ($c, $argv) = @_; my $st = $argv->[1] // $c->{sh}{q}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
$argv->[1] // $c->{"sh"}{"q"}
MC/DC0%0/2
$argv->[1] // $c->{"sh"}{"q"}
$argv->[1]
$c->{"sh"}{"q"}
Truth table66%2/3
A // B
A= $argv->[1]B= $c->{"sh"}{"q"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | 3 | ▶ | my $fr = $c->{frame} or return $c->{sh}{intext} ? leave($c, $st) # outside a function, in eval or . text: as exit | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | : Proc::ShellSpawn::fail($c, 2, "return: can only `return' from a function or sourced script"); # else an error, as bash (rule E) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | 2 | release_ctx($c); release_all(map $_->{scope}, @{$c->{loops}}); $fr->{ret}->($st) } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 65 | # ------------------------------------------------------------------ declarations | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 66 | 7 | ▶ | sub declare { # export, readonly, local: [NAME, Word or undef, ...]; $each->(NAME) after the value is set | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
declare: called CC=2 SCAR=8.5
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 67 | 7 | ▶ | my ($c, $list, $k, $each, $what) = @_; my @l = @$list; my @pairs; push @pairs, [splice @l, 0, 2] while @l; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 68 | 7 | my @log; # NAME or NAME=VALUE as set, for $Proc::ShellSpawn::ONBUILTIN (measurement) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 69 | 7 | ▶ | each_async(\@pairs, sub { my ($p, $next) = @_; my ($n, $w) = @$p; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=3 SCAR=15.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 70 | 0 | ▶ | return expand_str($c, $n, sub { my $m = shift; # export $v[=value] (parser item P4): the name known only now | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=3 SCAR=22.3
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 71 | 0 | ▶ | Proc::ShellSubset::settable($m) or return unsupported($c, "the name '$m' in 'export'"); # post-0.04: the old test let every name pass | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 72 | 0 | ▶ | return push(@log, $m), $each->($m), $next->() unless defined $w; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 73 | 0 | ▶ | expand_str($c, $w, sub { my $v = shift; push @log, "$m=$v"; setvar($c, $m, $v) or return; $each->($m); $next->() }) }) if ref $n; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=2 SCAR=14.3
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 74 | 7 | ▶ | return push(@log, $n), $each->($n), $next->() unless defined $w; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 75 | 6 | ▶ | expand_str($c, $w, sub { my $v = shift; push @log, "$n=$v"; setvar($c, $n, $v) or return; $each->($n); $next->() }) }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=7.0
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 76 | 7 | ▶ | sub { $Proc::ShellSpawn::ONBUILTIN->("x_$what", [$what, @log], {}) if $what && $Proc::ShellSpawn::ONBUILTIN; defer($k, 0) }) } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=3 SCAR=12.5
Branch: 1 branch
Condition33%1/3
$what and $Proc::ShellSpawn::ONBUILTIN
MC/DC0%0/2
$what and $Proc::ShellSpawn::ONBUILTIN
$what
$Proc::ShellSpawn::ONBUILTIN
Truth table33%1/3
A and B
A= $whatB= $Proc::ShellSpawn::ONBUILTIN
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 77 | 2 | ▶ | sub x_export { my ($c, $x, $tail, $k) = @_; declare($c, $x->{export}, $k, sub { $c->{sh}{exp}{$_[0]} = 1 }, 'export') } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
Subroutine
x_export: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 78 | 4 | ▶ | sub x_readonly { my ($c, $x, $tail, $k) = @_; declare($c, $x->{readonly}, $k, sub { $c->{sh}{ro}{$_[0]} = 1 }, 'readonly') } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
Subroutine
x_readonly: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 79 | 1 | ▶ | sub x_local { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
x_local: called CC=4 SCAR=14.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 80 | 1 | my ($c, $x, $tail, $k) = @_; my $fr = $c->{frame}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 81 | 1 | ▶ | return fail($c, 2, "local: not in a function") unless $fr; # A5 (reached only dynamically) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 82 | 1 | my $sh = $c->{sh}; my %l = @{$x->{local}}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 83 | 1 | ▶ | $fr->{saved}{$_} //= [exists $sh->{vars}{$_}, $sh->{vars}{$_}, $sh->{exp}{$_}] for keys %l; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$fr->{"saved"}{$_} //= [exists $sh->{"vars"}{$_}, $sh->{"vars"}{$_}, $sh->{"exp"}{$_}]
MC/DC0%0/1
$fr->{"saved"}{$_} //= [exists $sh->{"vars"}{$_}, $sh->{"vars"}{$_}, $sh->{"exp"}{$_}]
$fr->{"saved"}{$_}
Truth table50%1/2
A
A= $fr->{"saved"}{$_}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 84 | 1 | ▶ | declare($c, $x->{local}, $k, sub {}, 'local') } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 85 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 86 | # ------------------------------------------------------------------ exec with redirections only: for the rest of the shell | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 87 | 2 | ▶ | sub x_exec { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
x_exec: called CC=2 SCAR=7.3
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 88 | 2 | my ($c, $x, $tail, $k) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 89 | 2 | ▶ | redirect($c, $x->{redir} // [], sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=8 SCAR=22.3
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 90 | 2 | ▶ | my ($m, $opened) = @_ or return leave($c, 2); # a special builtin: a failed redirection ends the shell | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 91 | 2 | hold($_) for grep defined, values %$m; release($_) for @$opened; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 92 | 2 | ▶ | my $old = $c->{held} && !$c->{released} ? $c->{map} : {}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$c->{"held"} and not $c->{"released"}
MC/DC0%0/2
$c->{"held"} and not $c->{"released"}
$c->{"held"}
not $c->{"released"}
Truth table33%1/3
A and not(B)
A= $c->{"held"}B= not $c->{"released"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 93 | 2 | $c->{map} = $m; release($_) for grep defined, values %$old; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 94 | 2 | ▶ | push @{$c->{shell}{scope}}, $c unless $c->{held}; # released when the shell ends | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 95 | 2 | ▶ | @$c{qw(held released)} = (1, 0); defer($k, 0) }) } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$x->{"redir"} // []
MC/DC0%0/1
$x->{"redir"} // []
$x->{"redir"}
Truth table50%1/2
A
A= $x->{"redir"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 96 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 97 | # ------------------------------------------------------------------ builtins | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 98 | 3 | ▶ | sub b_shift { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
b_shift: called CC=3 SCAR=11.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 99 | 3 | ▶ | my ($c, $argv, $env, $k) = @_; my $n = $argv->[1] // 1; my $a = $c->{sh}{args}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$argv->[1] // 1
MC/DC100%1/1
$argv->[1] // 1
$argv->[1]
Truth table100%2/2
A
A= $argv->[1]
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 100 | 3 | ▶ | return fail($c, 2, "shift: can't shift that many") if $n > @$a; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 101 | 2 | splice @$a, 0, $n; defer($k, 0) } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 102 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 103 | 170 | my %OPT = (errexit => 'e', nounset => 'u', noglob => 'f', noclobber => 'C', allexport => 'a', | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 104 | notify => 'b', ignoreeof => 'ignoreeof', nolog => 'nolog'); # the last three, and +m, do nothing here (P6) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 105 | 40 | ▶ | sub b_set { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
b_set: called CC=15 SCAR=27.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 106 | 40 | my ($c, $argv, $env, $k) = @_; my @a = @$argv[1 .. $#$argv]; my $o = $c->{sh}{opt}; my $ops; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 107 | 40 | ▶ | while (@a) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 108 | 40 | my $x = $a[0]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 109 | 40 | ▶ | if ($x eq '--') { shift @a; $ops = 1; last } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 110 | 23 | ▶ | last unless $x =~ /^([-+])(.+)/; shift @a; my ($on, $f) = ($1 eq '-', $2); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 111 | return fail($c, 2, "set: Illegal option -o history") # B2: as dash, when the caller asked for dash's interactive builtins | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 112 | 23 | ▶ | if $f eq 'o' && ($a[0] // '') eq 'history' && $c->{sh}{interactive} eq 'dash'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition50%4/8
$f eq "o" and ($a[0] // "") eq "history" and $c->{"sh"}{"interactive"} eq "dash"
$f eq "o" and ($a[0] // "") eq "history"
$a[0] // ""
MC/DC0%0/3
$f eq "o" and ($a[0] // "") eq "history" and $c->{"sh"}{"interactive"} eq "dash"
$f eq "o"
$a[0]
$c->{"sh"}{"interactive"} eq "dash"
Truth table25%1/4
A and B and C
A= $f eq "o"B= $a[0]C= $c->{"sh"}{"interactive"} eq "dash"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 113 | 23 | ▶ | for my $l ($f eq 'o' ? $OPT{shift @a // ''} // '' : split //, $f) { $on ? ($o->{$l} = 1) : delete $o->{$l} } } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition75%3/4
$OPT{shift @a // ""} // ""
shift @a // ""
MC/DC100%1/1
$OPT{shift @a // ""} // ""
$OPT{shift @a // ""}
MC/DC0%0/1
shift @a // ""
shift @a
Truth table100%2/2
A
A= $OPT{shift @a // ""}
Truth table50%1/2
A
A= shift @a
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 114 | 40 | ▶ | $c->{sh}{args} = [@a] if $ops || @a; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$ops or @a
MC/DC50%1/2
$ops or @a
$ops
@a
Truth table66%2/3
A or B
A= $opsB= @a
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 115 | 40 | defer($k, 0) } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 116 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 117 | 6 | ▶ | sub b_eval { my ($c, $argv, $env, $k) = @_; run_text($c, join(' ', @$argv[1 .. $#$argv]), "'eval' text", $k) } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
b_eval: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 118 | 3 | ▶ | sub b_dot { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
b_dot: called CC=7 SCAR=21.2
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 119 | 3 | ▶ | my ($c, $argv, $env, $k) = @_; my $f = $argv->[1] // ''; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$argv->[1] // ""
MC/DC0%0/1
$argv->[1] // ""
$argv->[1]
Truth table50%1/2
A
A= $argv->[1]
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 120 | 3 | ▶ | my ($p) = Proc::ShellSpawn::has_dir($f) ? $f : grep -f Proc::ShellSpawn::path_in($c, $_), map +($_ eq '' ? '.' : $_) . "/$f", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 121 | Proc::ShellSpawn::path_list(var($c, 'PATH')); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 122 | 3 | ▶ | $p = Proc::ShellSpawn::path_in($c, $p) if defined $p; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 123 | 3 | ▶ | open my $fh, '<', $p // '' or return fail($c, 2, ".: cannot open $f: No such file"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition50%1/2
$p // ""
MC/DC0%0/1
$p // ""
$p
Truth table50%1/2
A
A= $p
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 124 | 2 | run_text($c, do { local $/; <$fh> }, "the text of '. $f'", $k) } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 125 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 126 | 170 | my %SIGNAME; { my @n = split ' ', $Config::Config{sig_name}; @SIGNAME{split ' ', $Config::Config{sig_num}} = @n; $SIGNAME{0} = 'EXIT' } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 127 | 170 | my %SIGNUM; @SIGNUM{split ' ', $Config::Config{sig_name}} = split ' ', $Config::Config{sig_num}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 128 | 23 | ▶ | sub b_trap { # names in any case, or numbers (P6); KILL and STOP cannot be caught: nothing to do, status 0, as both shells | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
b_trap: called CC=13 SCAR=25.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 129 | 23 | my ($c, $argv, $env, $k) = @_; my ($act, @sigs) = @$argv[1 .. $#$argv]; my $sh = $c->{sh}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 130 | 23 | ▶ | for my $s (map /^[0-9]+\z/ ? $SIGNAME{$_} // $_ : uc, @sigs) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$SIGNAME{$_} // $_
MC/DC0%0/2
$SIGNAME{$_} // $_
$SIGNAME{$_}
$_
Truth table33%1/3
A // B
A= $SIGNAME{$_}B= $_
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 131 | 24 | ▶ | next if $s eq 'KILL' || $s eq 'STOP'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$s eq "KILL" or $s eq "STOP"
MC/DC100%2/2
$s eq "KILL" or $s eq "STOP"
$s eq "KILL"
$s eq "STOP"
Truth table100%3/3
A or B
A= $s eq "KILL"B= $s eq "STOP"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 132 | 22 | ▶ | if ($act eq '-') { delete $sh->{trap}{$s} } else { $sh->{trap}{$s} = $act } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 133 | 22 | ▶ | next if $s eq 'EXIT'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 134 | 11 | my $w = $c; weaken $w; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 135 | 11 | ▶ | my $h = $sh->{tsub}{$s} = sub { return unless $w; push @{$w->{sh}{pend}}, $s; defer(\&run_pending, $w) }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=7.0
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 136 | 11 | ▶ | next unless exists $SIGNUM{$s}; # a signal Perl does not have here (Windows: USR1, ...): only kill ... $$ sends it | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 137 | 11 | ▶ | $Proc::ShellSpawn::TRAPSAVE{$s} //= $SIG{$s} // 'DEFAULT'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition75%3/4
$Proc::ShellSpawn::TRAPSAVE{$s} //= $SIG{$s} // "DEFAULT"
$SIG{$s} // "DEFAULT"
MC/DC0%0/1
$Proc::ShellSpawn::TRAPSAVE{$s} //= $SIG{$s} // "DEFAULT"
$Proc::ShellSpawn::TRAPSAVE{$s}
Truth table50%1/2
A
A= $Proc::ShellSpawn::TRAPSAVE{$s}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 138 | 11 | ▶ | $SIG{$s} = $act eq '-' ? $Proc::ShellSpawn::TRAPSAVE{$s} : $act eq '' ? 'IGNORE' : $h } # deferred: the action runs between | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 139 | # two reactions, and at the latest before the next command of a list (X19: as dash, before what follows the command) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 140 | 23 | defer($k, 0) } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 141 | 5 | ▶ | sub run_pending { # the actions of the signals caught since the last time, in order; then $k (and every other waiter) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
run_pending: called CC=3 SCAR=11.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 142 | 5 | my ($c, $k) = @_; my $sh = $c->{sh}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 143 | 5 | ▶ | push @{$sh->{twait}}, $k if $k; return if $sh->{tbusy}; $sh->{tbusy} = 1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 144 | 6 | ▶ | sub { my $p = $sh->{pend}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=5 SCAR=16.1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 145 | 6 | ▶ | return run_trap($c, shift @$p, __SUB__) if $p && @$p; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$p and @$p
MC/DC50%1/2
$p and @$p
$p
@$p
Truth table66%2/3
A and B
A= $pB= @$p
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 146 | 3 | ▶ | $sh->{tbusy} = 0; my @w = @{$sh->{twait} // []}; $sh->{twait} = []; $_->() for @w }->() } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$sh->{"twait"} // []
MC/DC100%1/1
$sh->{"twait"} // []
$sh->{"twait"}
Truth table100%2/2
A
A= $sh->{"twait"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 147 | 9 | ▶ | sub run_trap { # a trap's action; $? is kept | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
run_trap: called CC=4 SCAR=16.3
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 148 | 9 | my ($c, $s, $k) = @_; my $a = $c->{sh}{trap}{$s}; my $q = $c->{sh}{q}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 149 | 9 | ▶ | return $k && $k->(0) unless defined $a && $a ne ''; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition16%1/6
defined $a and $a ne ""
$k && &$k(0)
MC/DC0%0/2
defined $a and $a ne ""
defined $a
$a ne ""
MC/DC0%0/2
$k && &$k(0)
$k
&$k(0)
Truth table33%1/3
A and B
A= defined $aB= $a ne ""
Truth table0%0/3
A && B
A= $kB= &$k(0)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 150 | 9 | ▶ | run_text({ %$c, loops => [], held => 0, intrap => 1 }, $a, "the action of 'trap'", sub { $c->{sh}{q} = $q; $k->(0) if $k }) } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=7.1
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 151 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 152 | 12 | ▶ | sub b_wait { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
b_wait: called CC=7 SCAR=19.5
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 153 | 12 | my ($c, $argv, $env, $k) = @_; my @pid = @$argv[1 .. $#$argv]; my @j = @{$c->{sh}{jobl}}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 154 | 12 | ▶ | if (@pid) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 155 | 1 | ▶ | my $p = $pid[-1]; my ($j) = grep +($_->{first} // '') eq $p, @j; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$_->{"first"} // ""
MC/DC0%0/1
$_->{"first"} // ""
$_->{"first"}
Truth table50%1/2
A
A= $_->{"first"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 156 | 1 | ▶ | return defer($k, 127) unless $j; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 157 | 1 | ▶ | return defer($k, $j->{st}) if defined $j->{st}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 158 | 1 | ▶ | return push @{$j->{waiters}}, sub { defer($k, $j->{st}) } } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 159 | 11 | my @left = grep !defined $_->{st}, @j; my $n = @left; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 160 | 11 | ▶ | return defer($k, 0) unless $n; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 161 | 10 | ▶ | push @{$_->{waiters}}, sub { defer($k, 0) unless --$n } for @left } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=6.9
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 162 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 163 | 20 | ▶ | sub b_umask { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
b_umask: called CC=10 SCAR=24.1
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 164 | 20 | my ($c, $argv, $env, $k) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 165 | 20 | ▶ | return put($c, 1, sprintf("%04o\n", $c->{sh}{umask}), sub { $k->(0) }) unless defined(my $m = $argv->[1]); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 166 | 8 | ▶ | if ($m eq '-S') { # umask -S (parser item P4): u=rwx,g=rx,o=rx | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 167 | 0 | my $u = $c->{sh}{umask}; my @w = map { my $b = 7 & ~($u >> $_); join '', grep $b & {r => 4, w => 2, x => 1}->{$_}, qw(r w x) } 6, 3, 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 168 | 0 | ▶ | return put($c, 1, "u=$w[0],g=$w[1],o=$w[2]\n", sub { $k->(0) }) } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 169 | 8 | ▶ | if ($m =~ /^[ugoa]*[-+=]/) { # symbolic, as both shells (post4-0.03): on the permissions the mask leaves | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 170 | 3 | my $p = ~$c->{sh}{umask} & 0777; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 171 | 3 | for (split /,/, $m) { my ($who, $op, $perm) = /^([ugoa]*)([-+=])([rwx]*)\z/; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 172 | 4 | ▶ | my $w = 0; $w |= { u => 0700, g => 070, o => 07, a => 0777 }->{$_} for split //, $who || 'a'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$who || 'a'
MC/DC0%0/1
$who || 'a'
$who
Truth table50%1/2
A
A= $who
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 173 | 4 | my $b = 0; $b |= { r => 0444, w => 0222, x => 0111 }->{$_} for split //, $perm; $b &= $w; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 174 | 4 | ▶ | $p = $op eq '+' ? $p | $b : $op eq '-' ? $p & ~$b : ($p & ~$w) | $b } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 175 | 3 | $c->{sh}{umask} = ~$p & 0777; return defer($k, 0) } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 176 | 5 | $c->{sh}{umask} = oct $m; defer($k, 0) } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 177 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 178 | 170 | our $DEFPATH = '/usr/bin:/bin'; # command -p: bash's (glibc confstr _CS_PATH, in its order); dash adds /usr/sbin:/sbin | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 179 | 170 | my %ASPROG = map +($_ => 1), qw(echo printf test [ kill true false pwd cd); # command -v prints the name (spec, section 5) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 180 | 22 | ▶ | sub b_pwd { # X23 (the user's choice C, post2-0.03): the program, as '/bin/pwd -L', with PWD set to the shell's own | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
b_pwd: called CC=4 SCAR=13.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 181 | # directory, so that it prints what both shells print (the directory as reached, also through symbolic links); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 182 | # operands are dropped, as both shells ignore them (the program would warn); options as given, the last counts | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 183 | 22 | my ($c, $argv, $env, $k) = @_; my (undef, @a) = @$argv; my @o; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 184 | 22 | ▶ | while (@a && $a[0] =~ /^-/) { my $o = shift @a; last if $o eq '--'; push @o, $o } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition100%3/3
@a and $a[0] =~ /^-/
MC/DC100%2/2
@a and $a[0] =~ /^-/
@a
$a[0] =~ /^-/
Truth table100%3/3
A and B
A= @aB= $a[0] =~ /^-/
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 185 | 22 | spawn($c, $c->{map}, ['pwd', '-L', @o], { %$env, PWD => $c->{sh}{cwd} }, $k) } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 186 | 43 | ▶ | sub b_test { # rule F (post2-0.04): 's1 < s2', 's1 > s2' (also after '!'), which the program refuses, compared here by | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
b_test: called CC=11 SCAR=24.2
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 187 | # bytes, as both shells (POSIX 2024: "collates before/after ... in the current locale"; the same in the C locale); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 188 | # every other form: the program, as before (P5) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 189 | 43 | my ($c, $argv, $env, $k) = @_; my ($n, @a) = @$argv; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 190 | 43 | ▶ | if ($n eq '[') { return spawn($c, $c->{map}, $argv, $env, $k) unless @a && $a[-1] eq ']'; pop @a } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition33%1/3
@a and $a[-1] eq "]"
MC/DC0%0/2
@a and $a[-1] eq "]"
@a
$a[-1] eq "]"
Truth table33%1/3
A and B
A= @aB= $a[-1] eq "]"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 191 | 43 | ▶ | my $not = @a == 4 && $a[0] eq '!' and shift @a; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
@a == 4 && $a[0] eq '!'
MC/DC50%1/2
@a == 4 && $a[0] eq '!'
@a == 4
$a[0] eq '!'
Truth table66%2/3
A && B
A= @a == 4B= $a[0] eq '!'
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 192 | 43 | ▶ | return spawn($c, $c->{map}, $argv, $env, $k) unless @a == 3 && $a[1] =~ /^[<>]\z/; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
@a == 3 and $a[1] =~ /^[<>]\z/
MC/DC100%2/2
@a == 3 and $a[1] =~ /^[<>]\z/
@a == 3
$a[1] =~ /^[<>]\z/
Truth table100%3/3
A and B
A= @a == 3B= $a[1] =~ /^[<>]\z/
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 193 | 4 | ▶ | my $r = $a[1] eq '<' ? $a[0] lt $a[2] : $a[0] gt $a[2]; $r = !$r if $not; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 194 | 4 | ▶ | defer($k, $r ? 0 : 1) } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 195 | 17 | ▶ | sub b_command { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
b_command: called CC=20 SCAR=34.2
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 196 | 17 | my ($c, $argv, $env, $k) = @_; my (undef, @a) = @$argv; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 197 | 17 | ▶ | if (($a[0] // '') eq '-v') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition50%1/2
$a[0] // ""
MC/DC0%0/1
$a[0] // ""
$a[0]
Truth table50%1/2
A
A= $a[0]
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 198 | 12 | ▶ | my $n = $a[1] // ''; my $sh = $c->{sh}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$a[1] // ""
MC/DC0%0/1
$a[1] // ""
$a[1]
Truth table50%1/2
A
A= $a[1]
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 199 | 7 | ▶ | return put($c, 1, "$n\n", sub { $k->(0) }) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 200 | 12 | ▶ | if $sh->{cmd}{$n} || (Proc::ShellSpawn::cmd_of($n) // ['unsupported'])->[0] !~ /unsupported/ || $Proc::ShellSpawn::SPECIAL{$n} || $ASPROG{$n} || $Proc::ShellSubset::BI{$n}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition85%12/14
$sh->{"cmd"}{$n} or not +(Proc::ShellSpawn::cmd_of($n) // ["unsupported"])->[0] =~ /unsupported/ or $Proc::ShellSpawn::SPECIAL{$n} or $ASPROG{$n} or $Proc::ShellSubset::BI{$n}
$sh->{"cmd"}{$n} or not +(Proc::ShellSpawn::cmd_of($n) // ["unsupported"])->[0] =~ /unsupported/ or $Proc::ShellSpawn::SPECIAL{$n} or $ASPROG{$n}
$sh->{"cmd"}{$n} or not +(Proc::ShellSpawn::cmd_of($n) // ["unsupported"])->[0] =~ /unsupported/ or $Proc::ShellSpawn::SPECIAL{$n}
$sh->{"cmd"}{$n} or not +(Proc::ShellSpawn::cmd_of($n) // ["unsupported"])->[0] =~ /unsupported/
Proc::ShellSpawn::cmd_of($n) // ["unsupported"]
MC/DC0%0/5
$sh->{"cmd"}{$n} or not +(Proc::ShellSpawn::cmd_of($n) // ["unsupported"])->[0] =~ /unsupported/ or $Proc::ShellSpawn::SPECIAL{$n} or $ASPROG{$n} or $Proc::ShellSubset::BI{$n}
$sh->{"cmd"}{$n}
Proc::ShellSpawn::cmd_of($n)
$Proc::ShellSpawn::SPECIAL{$n}
$ASPROG{$n}
$Proc::ShellSubset::BI{$n}
Truth table16%1/6
A or not(B) or C or D or E
A= $sh->{"cmd"}{$n}B= Proc::ShellSpawn::cmd_of($n)C= $Proc::ShellSpawn::SPECIAL{$n}D= $ASPROG{$n}E= $Proc::ShellSubset::BI{$n}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 201 | 5 | my ($p) = find_cmd($c, $n, var($c, 'PATH')); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 202 | 5 | ▶ | $p //= $n if $Proc::ShellSpawn::INPROC{$n}; # run inside this process, no file (Windows): its name, as for a builtin | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$p //= $n
MC/DC0%0/2
$p //= $n
$p
$n
Truth table0%0/3
A //= B
A= $pB= $n
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 203 | 5 | ▶ | return defer($k, 127) unless defined $p; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 204 | 3 | ▶ | return put($c, 1, "$p\n", sub { $k->(0) }) } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 205 | 5 | ▶ | return defer($k, 0) unless @a; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 206 | 5 | ▶ | if ($a[0] eq '-p') { # command -p PROGRAM ... (parser item P4): looked up in a default PATH, run with the PATH it has | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 207 | 0 | shift @a; return (Proc::ShellSpawn::cmd_of($a[0]) // [''])->[0] !~ /b_test\z|^\z/ || $c->{sh}{cmd}{$a[0]} ? unsupported($c, "'command -p $a[0]'") | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 208 | 0 | ▶ | : spawn($c, $c->{map}, \@a, $env, $k, $DEFPATH) } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/5
not +(Proc::ShellSpawn::cmd_of($a[0]) // [""])->[0] =~ /b_test\z|^\z/ or $c->{"sh"}{"cmd"}{$a[0]}
Proc::ShellSpawn::cmd_of($a[0]) // [""]
MC/DC0%0/2
not +(Proc::ShellSpawn::cmd_of($a[0]) // [""])->[0] =~ /b_test\z|^\z/ or $c->{"sh"}{"cmd"}{$a[0]}
Proc::ShellSpawn::cmd_of($a[0])
$c->{"sh"}{"cmd"}{$a[0]}
Truth table0%0/3
not(A) or B
A= Proc::ShellSpawn::cmd_of($a[0])B= $c->{"sh"}{"cmd"}{$a[0]}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 209 | 5 | ▶ | return b_late($c, \@a, $env, $k) if $Proc::ShellSubset::REGBI{$a[0]}; # a builtin, not a function: its checks, then it (3A) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 210 | 2 | ▶ | if (my $e = Proc::ShellSpawn::cmd_of($a[0])) { return handler($e->[0])->($c, \@a, $env, $k, $e->[1]) } # a builtin, not a function | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 211 | 1 | spawn($c, $c->{map}, \@a, $env, $k) } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 212 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 213 | 21 | ▶ | sub b_getopts { # OPTSTRING NAME [ARGS]: as dash, also OPTIND inside grouped options (A5) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
b_getopts: called CC=19 SCAR=29.6
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 214 | 21 | my ($c, $argv, $env, $k) = @_; my (undef, $os, $name, @a) = @$argv; my $sh = $c->{sh}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 215 | 21 | ▶ | @a = @{$sh->{args}} unless @$argv > 3; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 216 | 21 | my $silent = $os =~ s/^://; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 217 | 21 | ▶ | my $ind = var($c, 'OPTIND'); $ind = 1 if $ind !~ /^[1-9][0-9]*\z/; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 218 | 21 | ▶ | my $off = ($sh->{optlast} // 0) eq $ind ? $sh->{optoff} // 0 : 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition75%3/4
$sh->{"optlast"} // 0
$sh->{"optoff"} // 0
MC/DC100%1/1
$sh->{"optlast"} // 0
$sh->{"optlast"}
MC/DC0%0/1
$sh->{"optoff"} // 0
$sh->{"optoff"}
Truth table100%2/2
A
A= $sh->{"optlast"}
Truth table50%1/2
A
A= $sh->{"optoff"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 219 | 21 | ▶ | $ind = 1, $off = 0 if $ind > @a + 1; # past the end of these arguments: dash starts over (L7) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 220 | 21 | ▶ | my $set = sub { my ($v, $st, @arg) = @_; # @arg undef: OPTARG unset (rule E: POSIX, as bash; dash keeps it, L8) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=6 SCAR=19.3
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 221 | 21 | ▶ | setvar($c, $name, $v) && setvar($c, OPTIND => $ind) or return; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
setvar($c, $name, $v) and setvar($c, "OPTIND", $ind)
MC/DC0%0/2
setvar($c, $name, $v) and setvar($c, "OPTIND", $ind)
setvar($c, $name, $v)
setvar($c, "OPTIND", $ind)
Truth table33%1/3
A and B
A= setvar($c, $name, $v)B= setvar($c, "OPTIND", $ind)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 222 | 21 | ▶ | !@arg ? () : defined $arg[0] ? setvar($c, OPTARG => $arg[0]) || return : delete $sh->{vars}{OPTARG}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition50%1/2
setvar($c, "OPTARG", $arg[0]) or return
MC/DC0%0/1
setvar($c, "OPTARG", $arg[0]) or return
setvar($c, "OPTARG", $arg[0])
Truth table50%1/2
A
A= setvar($c, "OPTARG", $arg[0])
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 223 | 21 | @$sh{qw(optlast optoff)} = ($ind, $off); defer($k, $st) }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 224 | 21 | my $cur; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 225 | 21 | ▶ | if ($off) { $cur = $a[$ind - 2] } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 226 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 227 | 20 | $cur = $a[$ind - 1]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 228 | 20 | ▶ | return $set->('?', 1, undef) if !defined $cur || $cur !~ /^-./; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
defined $cur and $cur =~ /^-./
MC/DC100%2/2
defined $cur and $cur =~ /^-./
defined $cur
$cur =~ /^-./
Truth table100%3/3
A and B
A= defined $curB= $cur =~ /^-./
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 229 | 15 | ▶ | $ind++; return $set->('?', 1, undef) if $cur eq '--'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 230 | 15 | $off = 1 } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 231 | 16 | ▶ | my $ch = substr $cur, $off++, 1; my $last = $off >= length $cur; $off = 0 if $last; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 232 | 16 | my $i = index $os, $ch; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 233 | 16 | ▶ | if ($ch eq ':' or $i < 0) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$ch eq ":" or $i < 0
MC/DC50%1/2
$ch eq ":" or $i < 0
$ch eq ":"
$i < 0
Truth table66%2/3
A or B
A= $ch eq ":"B= $i < 0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 234 | 4 | ▶ | return $silent ? $set->('?', 0, $ch) : msg($c, "Illegal option -$ch", sub { $set->('?', 0, undef) }) } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 235 | 12 | ▶ | return $set->($ch, 0, undef) unless substr($os, $i + 1, 1) eq ':'; # POSIX: OPTARG unset (rule E; dash: empty) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 236 | 7 | ▶ | unless ($last) { my $arg = substr $cur, $off; $off = 0; return $set->($ch, 0, $arg) } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 237 | 6 | ▶ | return $set->($ch, 0, $a[$ind++ - 1]) if defined $a[$ind - 1]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 238 | 2 | ▶ | $silent ? $set->(':', 0, $ch) : msg($c, "No arg for -$ch option", sub { $set->('?', 0, undef) }) } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 239 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 240 | 12 | ▶ | sub b_unset { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
b_unset: called CC=8 SCAR=20.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 241 | 12 | my ($c, $argv, $env, $k) = @_; my (undef, @n) = @$argv; my $sh = $c->{sh}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 242 | 12 | ▶ | my $f = ($n[0] // '') =~ /^-([vf])\z/ && (shift @n, $1)[1] // 'v'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition57%4/7
($n[0] // "") =~ /^-([vf])\z/ && (shift @n, $1)[1] // "v"
($n[0] // "") =~ /^-([vf])\z/ and (shift @n, $1)[1]
$n[0] // ""
MC/DC0%0/2
($n[0] // "") =~ /^-([vf])\z/ && (shift @n, $1)[1] // "v"
$n[0]
(shift @n, $1)[1]
Truth table33%1/3
A and B
A= $n[0]B= (shift @n, $1)[1]
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 243 | 12 | for (@n) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 244 | 13 | ▶ | if ($f eq 'f') { delete $sh->{cmd}{$_}; next } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 245 | # X35 (the user, 2026-11-08: as dash): a word that is not a name, from an expansion (a literal one the parser | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 246 | # rejects), stops the shell with status 2, as any error of a special builtin; the names before it are already unset | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 247 | 9 | ▶ | return fail($c, 2, "unset: $_: bad variable name") unless /^[A-Za-z_][A-Za-z0-9_]*\z/; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 248 | 5 | ▶ | return fail($c, 2, "unset: $_: is read only") if $sh->{ro}{$_}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 249 | 4 | delete $sh->{vars}{$_}; delete $sh->{exp}{$_} } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 250 | 7 | defer($k, 0) } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 251 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 252 | 22 | ▶ | sub b_kill { # kill ... $$: the shell takes the signal itself (F9); other process IDs go to the program kill | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
b_kill: called CC=20 SCAR=32.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 253 | 22 | my ($c, $argv, $env, $k) = @_; my (undef, @a) = @$argv; my $sh = $c->{sh}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 254 | 22 | my @o = @a; # K0 (the user, 2026-11-05): a signal (-N, -NAME, -s NAME), maybe '--', and no process ID: as both shells, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 255 | # status 2, with dash's text (the program kill: status 1, a long usage text). 'kill -s' alone: the program | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 256 | 22 | ▶ | if (@o && $o[0] eq '-s') { splice @o, 0, 2 } elsif (@o && $o[0] =~ /^-[0-9A-Za-z]+\z/ && $o[0] !~ /^-l/) { shift @o } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition88%8/9
@o and $o[0] eq "-s"
@o and $o[0] =~ /^-[0-9A-Za-z]+\z/ and not $o[0] =~ /^-l/
@o and $o[0] =~ /^-[0-9A-Za-z]+\z/
MC/DC100%2/2
@o and $o[0] eq "-s"
@o
$o[0] eq "-s"
MC/DC66%2/3
@o and $o[0] =~ /^-[0-9A-Za-z]+\z/ and not $o[0] =~ /^-l/
@o
$o[0] =~ /^-[0-9A-Za-z]+\z/
not $o[0] =~ /^-l/
Truth table100%3/3
A and B
A= @oB= $o[0] eq "-s"
Truth table75%3/4
A and B and not(C)
A= @oB= $o[0] =~ /^-[0-9A-Za-z]+\z/C= not $o[0] =~ /^-l/
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 257 | 22 | ▶ | shift @o if @o && $o[0] eq '--'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
@o and $o[0] eq "--"
MC/DC100%2/2
@o and $o[0] eq "--"
@o
$o[0] eq "--"
Truth table100%3/3
A and B
A= @oB= $o[0] eq "--"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 258 | 5 | ▶ | return msg($c, "kill: Usage: kill [-s sigspec | -signum | -sigspec] [pid | job]... or\nkill -l [exitstatus]", sub { $k->(2) }) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 259 | 22 | ▶ | if !@o && "@a" ne '-s'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
not @o and join($", @a) ne "-s"
MC/DC50%1/2
not @o and join($", @a) ne "-s"
not @o
join($", @a) ne "-s"
Truth table66%2/3
not(A) and B
A= not @oB= join($", @a) ne "-s"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 260 | 17 | ▶ | return spawn($c, $c->{map}, $argv, $env, $k) unless grep $_ eq $sh->{pid}, @a; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 261 | 16 | my $s = 'TERM'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 262 | 16 | ▶ | if (@a && $a[0] =~ /^-(?:s)?\z/ && @a > 1) { shift @a; $s = shift @a } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition66%4/6
@a and $a[0] =~ /^-(?:s)?\z/ and @a > 1
@a and $a[0] =~ /^-(?:s)?\z/
MC/DC33%1/3
@a and $a[0] =~ /^-(?:s)?\z/ and @a > 1
@a
$a[0] =~ /^-(?:s)?\z/
@a > 1
Truth table50%2/4
A and B and C
A= @aB= $a[0] =~ /^-(?:s)?\z/C= @a > 1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 263 | 14 | ▶ | elsif (@a && $a[0] =~ /^-(\w+)\z/) { shift @a; $s = $1 } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
@a and $a[0] =~ /^-(\w+)\z/
MC/DC0%0/2
@a and $a[0] =~ /^-(\w+)\z/
@a
$a[0] =~ /^-(\w+)\z/
Truth table33%1/3
A and B
A= @aB= $a[0] =~ /^-(\w+)\z/
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 264 | 16 | ▶ | $s = $SIGNAME{$s} // $s if $s =~ /^[0-9]+\z/; $s =~ s/^SIG//; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$SIGNAME{$s} // $s
MC/DC0%0/2
$SIGNAME{$s} // $s
$SIGNAME{$s}
$s
Truth table33%1/3
A // B
A= $SIGNAME{$s}B= $s
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 265 | 16 | my $harmless = $s =~ /^(?:CHLD|CLD|URG|WINCH|CONT)\z/; # post4-0.04: by default these do nothing to the shell (0 is EXIT here) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 266 | 16 | my @other = grep $_ ne $sh->{pid}, @a; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 267 | 16 | ▶ | my $m = $sh->{main} // $sh; # $$ is the main shell, also in a subshell: its trap counts (L6) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
$sh->{"main"} // $sh
MC/DC0%0/2
$sh->{"main"} // $sh
$sh->{"main"}
$sh
Truth table66%2/3
A // B
A= $sh->{"main"}B= $sh
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 268 | 16 | ▶ | my $self = sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=12 SCAR=27.8
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 269 | 16 | my $t = $m->{trap}{$s}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 270 | 16 | ▶ | return defer($k, 0) if $s eq 'EXIT' || $harmless && !defined $t; # kill -0 $$ only tests; as both shells, status 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition83%5/6
$s eq "EXIT" or $harmless and not defined $t
$harmless and not defined $t
MC/DC66%2/3
$s eq "EXIT" or $harmless and not defined $t
$s eq "EXIT"
$harmless
not defined $t
Truth table75%3/4
A or B and not(C)
A= $s eq "EXIT"B= $harmlessC= not defined $t
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 271 | 11 | ▶ | return defer($k, 0) if defined $t && $t eq ''; # ignored | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
defined $t and $t eq ""
MC/DC50%1/2
defined $t and $t eq ""
defined $t
$t eq ""
Truth table66%2/3
A and B
A= defined $tB= $t eq ""
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 272 | 9 | ▶ | return run_trap($c, $s, sub { defer($k, 0) }) if defined $t && $m == $sh; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
Branch: 1 branch
Condition66%2/3
defined $t and $m == $sh
MC/DC50%1/2
defined $t and $m == $sh
defined $t
$m == $sh
Truth table66%2/3
A and B
A= defined $tB= $m == $sh
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 273 | 3 | ▶ | if (defined $t) { my $h = $m->{tsub}{$s}; $h->($s) if $h; return defer($k, 0) } # as a real signal: the trap runs in the main shell | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 274 | 0 | ▶ | $m->{trap}{EXIT} = '' if exists $m->{trap}{EXIT}; # a death by the signal runs no EXIT trap | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 275 | 0 | $Proc::ShellSpawn::SIGNALLED = $s; # the caller may die by it too (try.pl does) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 276 | 0 | ▶ | $sh->{die}->(128 + ($SIGNUM{$s} // 15)) }; # the whole string ends, as sh -c would | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$SIGNUM{$s} // 15
MC/DC0%0/1
$SIGNUM{$s} // 15
$SIGNUM{$s}
Truth table0%0/2
A
A= $SIGNUM{$s}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 277 | 16 | ▶ | return $self->() unless @other; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 278 | 0 | ▶ | spawn($c, $c->{map}, ['kill', "-$s", @other], $env, sub { $self->() }) } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 279 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 280 | 170 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||