diff options
author | Eric Wong <e@80x24.org> | 2023-10-07 21:24:09 +0000 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2023-10-08 18:54:48 +0000 |
commit | ed1ad9b3b6ea3e6e22deaaf54fdc8230a3b09b8c (patch) | |
tree | dce43f04eaf5818ab783bcc859001c4e34fd618e /t | |
parent | 1661ff8e21f3cb1df1a3fc00d917f404f4eae734 (diff) | |
download | public-inbox-ed1ad9b3b6ea3e6e22deaaf54fdc8230a3b09b8c.tar.gz |
Specifying {cb_args} in the options hash felt awkward to me. Instead, just use the Perl stack like we do with awaitpid() and pass the list down directly.
Diffstat (limited to 't')
-rw-r--r-- | t/spawn.t | 8 |
1 files changed, 4 insertions, 4 deletions
@@ -140,13 +140,13 @@ EOF { # ->CLOSE vs ->DESTROY waitpid caller distinction my @c; - my $fh = popen_rd(['true'], undef, { cb_arg => [sub { @c = caller }] }); + my $fh = popen_rd(['true'], undef, undef, sub { @c = caller }); ok(close($fh), '->CLOSE fired and successful'); ok(scalar(@c), 'callback fired by ->CLOSE'); ok(grep(!m[/PublicInbox/DS\.pm\z], @c), 'callback not invoked by DS'); @c = (); - $fh = popen_rd(['true'], undef, { cb_arg => [sub { @c = caller }] }); + $fh = popen_rd(['true'], undef, undef, sub { @c = caller }); undef $fh; # ->DESTROY ok(scalar(@c), 'callback fired by ->DESTROY'); ok(grep(!m[/PublicInbox/ProcessIO\.pm\z], @c), @@ -157,8 +157,8 @@ EOF use POSIX qw(_exit); pipe(my ($r, $w)) or BAIL_OUT $!; my @arg; - my $cb = [ sub { @arg = @_; warn "x=$$\n" }, 'hi' ]; - my $fh = popen_rd(['cat'], undef, { 0 => $r, cb_arg => $cb }); + my $fh = popen_rd(['cat'], undef, { 0 => $r }, + sub { @arg = @_; warn "x=$$\n" }, 'hi'); my $pp = tied *$fh; my $pid = fork // BAIL_OUT $!; local $SIG{__WARN__} = sub { _exit(1) }; |