Skip to content

Commit 0051f50

Browse files
authored
Merge pull request #63 from Martchus/tidy
Apply tidy 20250105
2 parents 90706fb + 2884657 commit 0051f50

6 files changed

Lines changed: 39 additions & 16 deletions

File tree

lib/Mojo/IOLoop/ReadWriteProcess/Container.pm

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,8 +129,8 @@ sub start {
129129
$self->process->diag("Starting container");
130130
$self->process->diag("\tName: " . $self->name) if defined $self->name;
131131
$self->process->diag("\tGroup: " . $self->group) if defined $self->group;
132-
$self->cgroups->each(sub { $self->process->diag("CGroup: " . $_->_cgroup) }
133-
);
132+
$self->cgroups->each(
133+
sub { $self->process->diag("CGroup: " . $_->_cgroup) });
134134
}
135135

136136
local ($@, $!);

lib/Mojo/IOLoop/ReadWriteProcess/Session.pm

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,10 @@ sub enable {
6565
sub _collect {
6666
my ($self, $pid, $status, $errno) = @_;
6767
my $p = $singleton->resolve($pid);
68-
$p->emit('SIG_CHLD')->emit(collect_status => $pid => $status => $errno)
69-
->emit('collected')->emit('stop');
68+
$p->emit('SIG_CHLD')
69+
->emit(collect_status => $pid => $status => $errno)
70+
->emit('collected')
71+
->emit('stop');
7072
}
7173

7274
sub collect {

lib/Mojo/IOLoop/ReadWriteProcess/Shared/Semaphore.pm

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,10 @@ sub acquire {
4141
my %args = @_ % 2 == 0 ? @_ : @_ == 1 && ref $_[0] eq 'HASH' ? %{$_[0]} : ();
4242

4343
# Defaults
44-
$args{'sem'} = 0 unless defined($args{'sem'});
45-
$args{'wait'} = 0 unless defined($args{'wait'});
44+
$args{'sem'} = 0 unless defined($args{'sem'});
45+
$args{'wait'} = 0 unless defined($args{'wait'});
4646
$args{'max'} = -1 unless defined($args{'max'});
47-
$args{'undo'} = 0 unless defined($args{'undo'});
47+
$args{'undo'} = 0 unless defined($args{'undo'});
4848
warn "[debug:$$] Acquire semaphore " . $self->key if DEBUG;
4949

5050
my $sem = $self->_sem;

t/01_run.t

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,10 @@ subtest 'process(execute => /bin/true)' => sub {
297297
check_bin('/bin/true');
298298

299299
is(
300-
process(execute => '/bin/true')->quirkiness(1)->start()->wait_stop()
300+
process(execute => '/bin/true')
301+
->quirkiness(1)
302+
->start()
303+
->wait_stop()
301304
->exit_status(),
302305
0,
303306
'Simple exec of /bin/true return 0'
@@ -556,7 +559,9 @@ subtest 'process_args' => sub {
556559
->start->wait_stop();
557560
is($p->read_all_stdout(), "0$/1$/2$/3$/", '1) Args given as arrayref.');
558561

559-
$p = Mojo::IOLoop::ReadWriteProcess->new($code)->args([(0 .. 3)])
562+
$p
563+
= Mojo::IOLoop::ReadWriteProcess->new($code)
564+
->args([(0 .. 3)])
560565
->start->wait_stop();
561566
is($p->read_all_stdout(), "0$/1$/2$/3$/", '2) Args given as arrayref.');
562567
};
@@ -568,19 +573,27 @@ subtest 'process in process' => sub {
568573
my $p = process(
569574
sub {
570575
is(
571-
process(execute => '/bin/true')->quirkiness(1)->start()->wait_stop()
576+
process(execute => '/bin/true')
577+
->quirkiness(1)
578+
->start()
579+
->wait_stop()
572580
->exit_status(),
573581
0,
574582
'process(execute) from process(code) -- retval check true'
575583
);
576584
is(
577-
process(execute => '/bin/false')->quirkiness(1)->start()->wait_stop()
585+
process(execute => '/bin/false')
586+
->quirkiness(1)
587+
->start()
588+
->wait_stop()
578589
->exit_status(),
579590
1,
580591
'process(execute) from process(code) -- retval check false'
581592
);
582593
is(
583-
process(sub { print 'sub-sub-process' })->start()->wait_stop()
594+
process(sub { print 'sub-sub-process' })
595+
->start()
596+
->wait_stop()
584597
->read_all_stdout,
585598
'sub-sub-process',
586599
'process(code) works from process(code)'
@@ -613,7 +626,10 @@ subtest 'SIG_CHLD handler in spawned process' => sub {
613626
# somewhere like /opt/hostedtoolcache/perl/<version>/<arch>/bin/perl so
614627
# /usr/bin/perl wouldn't have all needed dependencies
615628
is(
616-
process(execute => 'perl')->args([$simple_rwp])->start()->wait_stop()
629+
process(execute => 'perl')
630+
->args([$simple_rwp])
631+
->start()
632+
->wait_stop()
617633
->exit_status(),
618634
0,
619635
'simple_rwp.pl exit with 0'

t/04_queues.t

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -173,8 +173,11 @@ subtest stress_test => sub {
173173
# Started as long as resources allows (maximum_processes of the main pool)
174174
# That requires then to subscribe for each process event's separately (manually)
175175
for (1 .. $proc) {
176-
my $p = process(sub { shift; sleep 4; exit shift() })->set_pipes(0)
177-
->internal_pipes(0)->args($i);
176+
my $p
177+
= process(sub { shift; sleep 4; exit shift() })
178+
->set_pipes(0)
179+
->internal_pipes(0)
180+
->args($i);
178181
$p->once(
179182
stop => sub {
180183
$fired++;

t/data/simple_rwp.pl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
use Mojo::IOLoop::ReadWriteProcess 'process';
55

66
# Not all systems have /bin/true, this is /usr/bin/true on osx for instance
7-
my $p = process(execute => 'command -v true || which true')->start()
7+
my $p
8+
= process(execute => 'command -v true || which true')
9+
->start()
810
->wait_stop->read_all_stdout;
911
exit process(execute => $p)->start()->wait_stop()->exit_status();

0 commit comments

Comments
 (0)