Script 'mail_helper' called by obssrc
Hello community,
here is the log from the commit of package perl-Mojo-IOLoop-ReadWriteProcess
for openSUSE:Factory checked in at 2022-12-13 18:55:18
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/perl-Mojo-IOLoop-ReadWriteProcess (Old)
and
/work/SRC/openSUSE:Factory/.perl-Mojo-IOLoop-ReadWriteProcess.new.1835 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "perl-Mojo-IOLoop-ReadWriteProcess"
Tue Dec 13 18:55:18 2022 rev:18 rq:1042463 version:0.33
Changes:
--------
---
/work/SRC/openSUSE:Factory/perl-Mojo-IOLoop-ReadWriteProcess/perl-Mojo-IOLoop-ReadWriteProcess.changes
2021-12-13 20:51:13.952667016 +0100
+++
/work/SRC/openSUSE:Factory/.perl-Mojo-IOLoop-ReadWriteProcess.new.1835/perl-Mojo-IOLoop-ReadWriteProcess.changes
2022-12-13 18:55:33.571232790 +0100
@@ -1,0 +2,16 @@
+Mon Dec 12 20:21:31 UTC 2022 - Tina Müller <[email protected]>
+
+- updated to 0.33
+ see /usr/share/doc/packages/perl-Mojo-IOLoop-ReadWriteProcess/Changes
+
+ 0.33 2022-12-12T12:22:13Z
+ - Apply perltidy v20221112
+ - remove hard-coding of OABI syscall entry point
+ - Fix typos detected by lintian (Debian) (#47)
+ - tests: Check executable, before using it in tests
+ - Fix sporadic 01_run.t failure -- "process is still running"
+ - Fix all .perltidyrc violations
+ - Run perltidy for pull requests
+ - Add test for SIG_CHLD handler in spawned process
+
+-------------------------------------------------------------------
Old:
----
Mojo-IOLoop-ReadWriteProcess-0.32.tar.gz
New:
----
Mojo-IOLoop-ReadWriteProcess-0.33.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ perl-Mojo-IOLoop-ReadWriteProcess.spec ++++++
--- /var/tmp/diff_new_pack.d9NeYv/_old 2022-12-13 18:55:34.151235885 +0100
+++ /var/tmp/diff_new_pack.d9NeYv/_new 2022-12-13 18:55:34.155235907 +0100
@@ -1,7 +1,7 @@
#
# spec file for package perl-Mojo-IOLoop-ReadWriteProcess
#
-# Copyright (c) 2021 SUSE LLC
+# Copyright (c) 2022 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@@ -18,10 +18,10 @@
%define cpan_name Mojo-IOLoop-ReadWriteProcess
Name: perl-Mojo-IOLoop-ReadWriteProcess
-Version: 0.32
+Version: 0.33
Release: 0
-Summary: Execute external programs or internal code blocks as separate
process
License: Artistic-1.0 OR GPL-1.0-or-later
+Summary: Execute external programs or internal code blocks as separate
process
URL: https://metacpan.org/release/%{cpan_name}
Source0:
https://cpan.metacpan.org/authors/id/S/SZ/SZARATE/%{cpan_name}-%{version}.tar.gz
Source1: cpanspec.yml
++++++ Mojo-IOLoop-ReadWriteProcess-0.32.tar.gz ->
Mojo-IOLoop-ReadWriteProcess-0.33.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Mojo-IOLoop-ReadWriteProcess-0.32/Changes
new/Mojo-IOLoop-ReadWriteProcess-0.33/Changes
--- old/Mojo-IOLoop-ReadWriteProcess-0.32/Changes 2021-12-09
19:04:50.000000000 +0100
+++ new/Mojo-IOLoop-ReadWriteProcess-0.33/Changes 2022-12-12
13:24:02.000000000 +0100
@@ -1,6 +1,17 @@
Revision history for Perl extension Mojo-IOLoop-ReadWriteProcess
+0.33 2022-12-12T12:22:13Z
+ - Apply perltidy v20221112
+ - remove hard-coding of OABI syscall entry point
+ - Fix typos detected by lintian (Debian) (#47)
+ - tests: Check executable, before using it in tests
+ - Fix sporadic 01_run.t failure -- "process is still running"
+ - Fix all .perltidyrc violations
+ - Run perltidy for pull requests
+ - Add test for SIG_CHLD handler in spawned process
+
+
0.32 2021-12-09T18:03:02Z
- Project moved to https://github.com/openSUSE/Mojo-IOLoop-ReadWriteProcess
- Introduce emit_from_sigchld()
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Mojo-IOLoop-ReadWriteProcess-0.32/MANIFEST
new/Mojo-IOLoop-ReadWriteProcess-0.33/MANIFEST
--- old/Mojo-IOLoop-ReadWriteProcess-0.32/MANIFEST 2021-12-09
19:04:50.000000000 +0100
+++ new/Mojo-IOLoop-ReadWriteProcess-0.33/MANIFEST 2022-12-12
13:24:02.000000000 +0100
@@ -50,7 +50,9 @@
t/12_mocked_container.t
t/13_shared.t
t/data/process_check.sh
+t/data/sigchld_handler.pl
t/data/simple_fork.pl
+t/data/simple_rwp.pl
t/data/subreaper/child.sh
t/data/subreaper/dead_child.sh
t/data/subreaper/dead_master.sh
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Mojo-IOLoop-ReadWriteProcess-0.32/META.json
new/Mojo-IOLoop-ReadWriteProcess-0.33/META.json
--- old/Mojo-IOLoop-ReadWriteProcess-0.32/META.json 2021-12-09
19:04:50.000000000 +0100
+++ new/Mojo-IOLoop-ReadWriteProcess-0.33/META.json 2022-12-12
13:24:02.000000000 +0100
@@ -4,7 +4,7 @@
"Ettore Di Giacinto <[email protected]>"
],
"dynamic_config" : 0,
- "generated_by" : "Minilla/v3.1.12",
+ "generated_by" : "Minilla/v3.1.20",
"license" : [
"perl_5"
],
@@ -60,7 +60,7 @@
"provides" : {
"Mojo::IOLoop::ReadWriteProcess" : {
"file" : "lib/Mojo/IOLoop/ReadWriteProcess.pm",
- "version" : "0.32"
+ "version" : "0.33"
},
"Mojo::IOLoop::ReadWriteProcess::CGroup" : {
"file" : "lib/Mojo/IOLoop/ReadWriteProcess/CGroup.pm"
@@ -148,25 +148,30 @@
},
"homepage" : "https://github.com/openSUSE/Mojo-IOLoop-ReadWriteProcess",
"repository" : {
- "url" : "git://github.com/openSUSE/Mojo-IOLoop-ReadWriteProcess.git",
+ "type" : "git",
+ "url" :
"https://github.com/openSUSE/Mojo-IOLoop-ReadWriteProcess.git",
"web" : "https://github.com/openSUSE/Mojo-IOLoop-ReadWriteProcess"
}
},
- "version" : "0.32",
+ "version" : "0.33",
"x_contributors" : [
"Adam Williamson <[email protected]>",
"Clemens Famulla-Conrad <[email protected]>",
"Ettore Di Giacinto <[email protected]>",
"Ettore Di Giacinto <[email protected]>",
"Marius Kittler <[email protected]>",
+ "Martchus <[email protected]>",
"Mohammad S Anwar <[email protected]>",
+ "Nick Morrott <[email protected]>",
"Oliver Kurz <[email protected]>",
"Santiago Zarate <[email protected]>",
"Santiago Zarate <[email protected]>",
"Santiago Zarate <[email protected]>",
+ "Sebastian Riedel <[email protected]>",
"Sebastian Riedel <[email protected]>",
- "cfconrad <[email protected]>"
+ "cfconrad <[email protected]>",
+ "gregor herrmann <[email protected]>"
],
- "x_serialization_backend" : "JSON::PP version 4.06",
+ "x_serialization_backend" : "JSON::PP version 4.12",
"x_static_install" : 0
}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Mojo-IOLoop-ReadWriteProcess-0.32/META.yml
new/Mojo-IOLoop-ReadWriteProcess-0.33/META.yml
--- old/Mojo-IOLoop-ReadWriteProcess-0.32/META.yml 2021-12-09
19:04:50.000000000 +0100
+++ new/Mojo-IOLoop-ReadWriteProcess-0.33/META.yml 2022-12-12
13:24:02.000000000 +0100
@@ -9,7 +9,7 @@
Module::Build: '0.4005'
perl: '5.016'
dynamic_config: 0
-generated_by: 'Minilla/v3.1.12, CPAN::Meta::Converter version 2.150010'
+generated_by: 'Minilla/v3.1.20, CPAN::Meta::Converter version 2.150010'
license: perl
meta-spec:
url: http://module-build.sourceforge.net/META-spec-v1.4.html
@@ -28,7 +28,7 @@
provides:
Mojo::IOLoop::ReadWriteProcess:
file: lib/Mojo/IOLoop/ReadWriteProcess.pm
- version: '0.32'
+ version: '0.33'
Mojo::IOLoop::ReadWriteProcess::CGroup:
file: lib/Mojo/IOLoop/ReadWriteProcess/CGroup.pm
Mojo::IOLoop::ReadWriteProcess::CGroup::v1:
@@ -87,20 +87,24 @@
resources:
bugtracker: https://github.com/openSUSE/Mojo-IOLoop-ReadWriteProcess/issues
homepage: https://github.com/openSUSE/Mojo-IOLoop-ReadWriteProcess
- repository: git://github.com/openSUSE/Mojo-IOLoop-ReadWriteProcess.git
-version: '0.32'
+ repository: https://github.com/openSUSE/Mojo-IOLoop-ReadWriteProcess.git
+version: '0.33'
x_contributors:
- 'Adam Williamson <[email protected]>'
- 'Clemens Famulla-Conrad <[email protected]>'
- 'Ettore Di Giacinto <[email protected]>'
- 'Ettore Di Giacinto <[email protected]>'
- 'Marius Kittler <[email protected]>'
+ - 'Martchus <[email protected]>'
- 'Mohammad S Anwar <[email protected]>'
+ - 'Nick Morrott <[email protected]>'
- 'Oliver Kurz <[email protected]>'
- 'Santiago Zarate <[email protected]>'
- 'Santiago Zarate <[email protected]>'
- 'Santiago Zarate <[email protected]>'
+ - 'Sebastian Riedel <[email protected]>'
- 'Sebastian Riedel <[email protected]>'
- 'cfconrad <[email protected]>'
+ - 'gregor herrmann <[email protected]>'
x_serialization_backend: 'CPAN::Meta::YAML version 0.018'
x_static_install: 0
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Mojo-IOLoop-ReadWriteProcess-0.32/README.md
new/Mojo-IOLoop-ReadWriteProcess-0.33/README.md
--- old/Mojo-IOLoop-ReadWriteProcess-0.32/README.md 2021-12-09
19:04:50.000000000 +0100
+++ new/Mojo-IOLoop-ReadWriteProcess-0.33/README.md 2022-12-12
13:24:02.000000000 +0100
@@ -266,7 +266,7 @@
## kill\_sleeptime
-Defaults to `1`, it's the seconds to wait before attempting SIGKILL when
blocking\_stop is setted to 1.
+Defaults to `1`, it's the seconds to wait before attempting SIGKILL when
blocking\_stop is set to 1.
## separate\_err
@@ -361,7 +361,7 @@
my $p = process()->enable_subreaper;
Mark the current process (not the child) as subreaper.
-This is used typically if you want to mark further childs as subreapers inside
other forks.
+This is used typically if you want to mark further children as subreapers
inside other forks.
my $master_p = process(
sub {
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/Mojo-IOLoop-ReadWriteProcess-0.32/lib/Mojo/IOLoop/ReadWriteProcess/CGroup/v1/Cpuset.pm
new/Mojo-IOLoop-ReadWriteProcess-0.33/lib/Mojo/IOLoop/ReadWriteProcess/CGroup/v1/Cpuset.pm
---
old/Mojo-IOLoop-ReadWriteProcess-0.32/lib/Mojo/IOLoop/ReadWriteProcess/CGroup/v1/Cpuset.pm
2021-12-09 19:04:50.000000000 +0100
+++
new/Mojo-IOLoop-ReadWriteProcess-0.33/lib/Mojo/IOLoop/ReadWriteProcess/CGroup/v1/Cpuset.pm
2022-12-12 13:24:02.000000000 +0100
@@ -58,12 +58,12 @@
sub sched_load_balance {
shift->cgroup->_flag(SCHED_LOAD_BALANCE_INTERFACE, @_);
}
-sub memory_spread_slab { shift->cgroup->_flag(MEM_SPREAD_SLAB_INTERFACE, @_) }
-sub memory_spread_page { shift->cgroup->_flag(MEM_SPREAD_PAGE_INTERFACE, @_) }
+sub memory_spread_slab { shift->cgroup->_flag(MEM_SPREAD_SLAB_INTERFACE, @_) }
+sub memory_spread_page { shift->cgroup->_flag(MEM_SPREAD_PAGE_INTERFACE, @_) }
sub get_memory_pressure { shift->cgroup->_list(MEM_PRESSURE_INTERFACE) }
-sub mem_hardwall { shift->cgroup->_flag(MEM_HARDWALL_INTERFACE, @_) }
-sub mem_exclusive { shift->cgroup->_flag(MEM_EXCLUSIVE_INTERFACE, @_) }
-sub cpu_exclusive { shift->cgroup->_flag(CPU_EXCLUSIVE_INTERFACE, @_) }
+sub mem_hardwall { shift->cgroup->_flag(MEM_HARDWALL_INTERFACE, @_) }
+sub mem_exclusive { shift->cgroup->_flag(MEM_EXCLUSIVE_INTERFACE, @_) }
+sub cpu_exclusive { shift->cgroup->_flag(CPU_EXCLUSIVE_INTERFACE, @_) }
sub memory_migrate { shift->cgroup->_flag(MEMORY_MIGRATE_INTERFACE, @_) }
1;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/Mojo-IOLoop-ReadWriteProcess-0.32/lib/Mojo/IOLoop/ReadWriteProcess/CGroup/v2/CPU.pm
new/Mojo-IOLoop-ReadWriteProcess-0.33/lib/Mojo/IOLoop/ReadWriteProcess/CGroup/v2/CPU.pm
---
old/Mojo-IOLoop-ReadWriteProcess-0.32/lib/Mojo/IOLoop/ReadWriteProcess/CGroup/v2/CPU.pm
2021-12-09 19:04:50.000000000 +0100
+++
new/Mojo-IOLoop-ReadWriteProcess-0.33/lib/Mojo/IOLoop/ReadWriteProcess/CGroup/v2/CPU.pm
2022-12-12 13:24:02.000000000 +0100
@@ -12,9 +12,9 @@
has cgroup => sub { Mojo::IOLoop::ReadWriteProcess::CGroup::v2->new };
sub stat { shift->cgroup->_list(STAT_INTERFACE) }
-sub weight { shift->cgroup->_setget(WEIGHT_INTERFACE, @_) }
+sub weight { shift->cgroup->_setget(WEIGHT_INTERFACE, @_) }
sub weight_nice { shift->cgroup->_setget(WEIGHT_NICE_INTERFACE, @_) }
-sub max { shift->cgroup->_setget(MAX_INTERFACE, @_) }
+sub max { shift->cgroup->_setget(MAX_INTERFACE, @_) }
1;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/Mojo-IOLoop-ReadWriteProcess-0.32/lib/Mojo/IOLoop/ReadWriteProcess/CGroup/v2/IO.pm
new/Mojo-IOLoop-ReadWriteProcess-0.33/lib/Mojo/IOLoop/ReadWriteProcess/CGroup/v2/IO.pm
---
old/Mojo-IOLoop-ReadWriteProcess-0.32/lib/Mojo/IOLoop/ReadWriteProcess/CGroup/v2/IO.pm
2021-12-09 19:04:50.000000000 +0100
+++
new/Mojo-IOLoop-ReadWriteProcess-0.33/lib/Mojo/IOLoop/ReadWriteProcess/CGroup/v2/IO.pm
2022-12-12 13:24:02.000000000 +0100
@@ -12,7 +12,7 @@
sub stat { shift->cgroup->_list(STAT_INTERFACE) }
sub weight { shift->cgroup->_setget(WEIGHT_INTERFACE, @_) }
-sub max { shift->cgroup->_setget(MAX_INTERFACE, @_) }
+sub max { shift->cgroup->_setget(MAX_INTERFACE, @_) }
1;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/Mojo-IOLoop-ReadWriteProcess-0.32/lib/Mojo/IOLoop/ReadWriteProcess/CGroup/v2/Memory.pm
new/Mojo-IOLoop-ReadWriteProcess-0.33/lib/Mojo/IOLoop/ReadWriteProcess/CGroup/v2/Memory.pm
---
old/Mojo-IOLoop-ReadWriteProcess-0.32/lib/Mojo/IOLoop/ReadWriteProcess/CGroup/v2/Memory.pm
2021-12-09 19:04:50.000000000 +0100
+++
new/Mojo-IOLoop-ReadWriteProcess-0.33/lib/Mojo/IOLoop/ReadWriteProcess/CGroup/v2/Memory.pm
2022-12-12 13:24:02.000000000 +0100
@@ -18,9 +18,9 @@
sub current { shift->cgroup->_list(CURRENT_INTERFACE) }
sub swap_current { shift->cgroup->_list(SWAP_CURRENT_INTERFACE) }
-sub low { shift->cgroup->_setget(LOW_INTERFACE, @_) }
-sub high { shift->cgroup->_setget(HIGH_INTERFACE, @_) }
-sub max { shift->cgroup->_setget(MAX_INTERFACE, @_) }
+sub low { shift->cgroup->_setget(LOW_INTERFACE, @_) }
+sub high { shift->cgroup->_setget(HIGH_INTERFACE, @_) }
+sub max { shift->cgroup->_setget(MAX_INTERFACE, @_) }
sub swap_max { shift->cgroup->_setget(SWAP_MAX_INTERFACE, @_) }
sub events { shift->cgroup->_list(EVENTS_INTERFACE) }
sub stat { shift->cgroup->_list(STAT_INTERFACE) }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/Mojo-IOLoop-ReadWriteProcess-0.32/lib/Mojo/IOLoop/ReadWriteProcess/Container.pm
new/Mojo-IOLoop-ReadWriteProcess-0.33/lib/Mojo/IOLoop/ReadWriteProcess/Container.pm
---
old/Mojo-IOLoop-ReadWriteProcess-0.32/lib/Mojo/IOLoop/ReadWriteProcess/Container.pm
2021-12-09 19:04:50.000000000 +0100
+++
new/Mojo-IOLoop-ReadWriteProcess-0.33/lib/Mojo/IOLoop/ReadWriteProcess/Container.pm
2022-12-12 13:24:02.000000000 +0100
@@ -197,7 +197,7 @@
=head1 DESCRIPTION
-L<Mojo::IOLoop::ReadWriteProcess::Container> ties anonymous functions or a
L<Mojo::IOLoop::ReadWriteProcess> object to differents
+L<Mojo::IOLoop::ReadWriteProcess::Container> ties anonymous functions or a
L<Mojo::IOLoop::ReadWriteProcess> object to different
sets of L<Mojo::IOLoop::ReadWriteProcess::CGroup> implementations.
When the C<pid_isolation> attribute is set, it needs special permissions
(CAP_SYS_ADMIN capabilities).
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/Mojo-IOLoop-ReadWriteProcess-0.32/lib/Mojo/IOLoop/ReadWriteProcess/Session.pm
new/Mojo-IOLoop-ReadWriteProcess-0.33/lib/Mojo/IOLoop/ReadWriteProcess/Session.pm
---
old/Mojo-IOLoop-ReadWriteProcess-0.32/lib/Mojo/IOLoop/ReadWriteProcess/Session.pm
2021-12-09 19:04:50.000000000 +0100
+++
new/Mojo-IOLoop-ReadWriteProcess-0.33/lib/Mojo/IOLoop/ReadWriteProcess/Session.pm
2022-12-12 13:24:02.000000000 +0100
@@ -56,7 +56,8 @@
while ((my $pid = waitpid(-1, WNOHANG)) > 0) {
$singleton->add_collected_info($pid, $?, $!);
}
- $singleton->consume_collected_info() if
($singleton->emit_from_sigchld());
+ $singleton->consume_collected_info()
+ if ($singleton->emit_from_sigchld());
}
});
}
@@ -84,14 +85,14 @@
}
sub consume_collected_info {
- while(my $i = shift @{$singleton->collected_info}) {
- $singleton->collect(@$i)
- }
+ while (my $i = shift @{$singleton->collected_info}) {
+ $singleton->collect(@$i);
+ }
}
sub add_collected_info {
- shift;
- push @{$singleton->collected_info}, [@_];
+ shift;
+ push @{$singleton->collected_info}, [@_];
}
# Use as $pid => Mojo::IOLoop::ReadWriteProcess
@@ -135,7 +136,11 @@
$singleton->all->grep(sub { $_->pid eq $pid })->size == 1;
}
-sub reset { @{+shift}{qw(events orphans process_table collected_info handler
emit_from_sigchld)} = ({}, {}, {}, [], undef, 1) }
+sub reset {
+ @{+shift}
+ {qw(events orphans process_table collected_info handler emit_from_sigchld)}
+ = ({}, {}, {}, [], undef, 1);
+}
# XXX: This should be replaced by PR_GET_CHILD_SUBREAPER
sub disable_subreaper {
@@ -170,7 +175,6 @@
: ($machine eq "ppc" || $machine eq "ppc64le") ? 171
: $machine eq "ia64" ? 1170
: $machine eq "alpha" ? 348
- : ($machine eq "arm" || $machine eq "armv7l") ? 0x900000 + 172
: $machine eq "avr32" ? 148
: $machine eq "mips" ? 4000 + 192
: $machine eq "mips64" ? 5000 + 153
@@ -361,7 +365,7 @@
session->enable_subreaper;
Mark the current process (not the child) as subreaper.
-This is used typically if you want to mark further childs as subreapers inside
other forks.
+This is used typically if you want to mark further children as subreapers
inside other forks.
use Mojo::IOLoop::ReadWriteProcess::Session qw(session);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/Mojo-IOLoop-ReadWriteProcess-0.32/lib/Mojo/IOLoop/ReadWriteProcess/Shared/Lock.pm
new/Mojo-IOLoop-ReadWriteProcess-0.33/lib/Mojo/IOLoop/ReadWriteProcess/Shared/Lock.pm
---
old/Mojo-IOLoop-ReadWriteProcess-0.32/lib/Mojo/IOLoop/ReadWriteProcess/Shared/Lock.pm
2021-12-09 19:04:50.000000000 +0100
+++
new/Mojo-IOLoop-ReadWriteProcess-0.33/lib/Mojo/IOLoop/ReadWriteProcess/Shared/Lock.pm
2022-12-12 13:24:02.000000000 +0100
@@ -134,7 +134,7 @@
$l->locked; # is 0
-Executes a function inside a locked section. Errors are catched so lock is
released in case of failures.
+Executes a function inside a locked section. Errors are caught so lock is
released in case of failures.
=head1 ATTRIBUTES
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/Mojo-IOLoop-ReadWriteProcess-0.32/lib/Mojo/IOLoop/ReadWriteProcess/Shared/Memory.pm
new/Mojo-IOLoop-ReadWriteProcess-0.33/lib/Mojo/IOLoop/ReadWriteProcess/Shared/Memory.pm
---
old/Mojo-IOLoop-ReadWriteProcess-0.32/lib/Mojo/IOLoop/ReadWriteProcess/Shared/Memory.pm
2021-12-09 19:04:50.000000000 +0100
+++
new/Mojo-IOLoop-ReadWriteProcess-0.33/lib/Mojo/IOLoop/ReadWriteProcess/Shared/Memory.pm
2022-12-12 13:24:02.000000000 +0100
@@ -15,8 +15,8 @@
has key => sub { Mojo::IOLoop::ReadWriteProcess::Shared::Semaphore::_genkey()
};
has 'buffer';
-has destroy => 0;
-has flags => S_IRWXU() | S_IRWXG() | IPC_CREAT();
+has destroy => 0;
+has flags => S_IRWXU() | S_IRWXG() | IPC_CREAT();
has lock_flags => IPC_CREAT | IPC_EXCL | S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP
| S_IROTH | S_IWOTH;
has _size => 10 * 1024;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/Mojo-IOLoop-ReadWriteProcess-0.32/lib/Mojo/IOLoop/ReadWriteProcess/Shared/Semaphore.pm
new/Mojo-IOLoop-ReadWriteProcess-0.33/lib/Mojo/IOLoop/ReadWriteProcess/Shared/Semaphore.pm
---
old/Mojo-IOLoop-ReadWriteProcess-0.32/lib/Mojo/IOLoop/ReadWriteProcess/Shared/Semaphore.pm
2021-12-09 19:04:50.000000000 +0100
+++
new/Mojo-IOLoop-ReadWriteProcess-0.33/lib/Mojo/IOLoop/ReadWriteProcess/Shared/Semaphore.pm
2022-12-12 13:24:02.000000000 +0100
@@ -10,11 +10,11 @@
use Exporter 'import';
use constant DEBUG => $ENV{MOJO_PROCESS_DEBUG};
-has key => sub { shift->_genkey };
-has _sem => sub { $_[0]->_create(shift->key) };
+has key => sub { shift->_genkey };
+has _sem => sub { $_[0]->_create(shift->key) };
has count => 1;
has _value => 1;
-has flags => IPC_CREAT | IPC_EXCL | S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP
+has flags => IPC_CREAT | IPC_EXCL | S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP
| S_IROTH | S_IWOTH;
sub semaphore { __PACKAGE__->new(@_) }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/Mojo-IOLoop-ReadWriteProcess-0.32/lib/Mojo/IOLoop/ReadWriteProcess.pm
new/Mojo-IOLoop-ReadWriteProcess-0.33/lib/Mojo/IOLoop/ReadWriteProcess.pm
--- old/Mojo-IOLoop-ReadWriteProcess-0.32/lib/Mojo/IOLoop/ReadWriteProcess.pm
2021-12-09 19:04:50.000000000 +0100
+++ new/Mojo-IOLoop-ReadWriteProcess-0.33/lib/Mojo/IOLoop/ReadWriteProcess.pm
2022-12-12 13:24:02.000000000 +0100
@@ -1,6 +1,6 @@
package Mojo::IOLoop::ReadWriteProcess;
-our $VERSION = '0.32';
+our $VERSION = '0.33';
use Mojo::Base 'Mojo::EventEmitter';
use Mojo::File 'path';
@@ -56,8 +56,8 @@
has _deparse => sub { B::Deparse->new }
if DEBUG;
-has _deserialize => sub { \&Storable::thaw };
-has _serialize => sub { \&Storable::freeze };
+has _deserialize => sub { \&Storable::thaw };
+has _serialize => sub { \&Storable::freeze };
has _default_kill_signal => POSIX::SIGTERM;
has _default_blocking_signal => POSIX::SIGKILL;
@@ -76,7 +76,7 @@
my $me = $$;
$stream->on(
close => sub {
- return unless $$ == $me;
+ return unless $$ == $me;
$self->_collect->stop unless defined $self->_status;
});
return $stream;
@@ -396,10 +396,11 @@
sub restart {
$_[0]->is_running ? $_[0]->stop->start : $_[0]->start;
}
+
sub is_running {
- my ($self) = shift;
- $self->session->consume_collected_info;
- $self->process_id ? kill 0 => $self->process_id : 0;
+ my ($self) = shift;
+ $self->session->consume_collected_info;
+ $self->process_id ? kill 0 => $self->process_id : 0;
}
sub write_pidfile {
@@ -513,7 +514,7 @@
my $self = shift;
my $pid = $self->pid;
- return $self unless defined $pid;
+ return $self unless defined $pid;
return $self->_shutdown(1) unless $self->is_running;
$self->_diag("Stopping $pid") if DEBUG;
@@ -902,7 +903,7 @@
=head2 kill_sleeptime
-Defaults to C<1>, it's the seconds to wait before attempting SIGKILL when
blocking_stop is setted to 1.
+Defaults to C<1>, it's the seconds to wait before attempting SIGKILL when
blocking_stop is set to 1.
=head2 separate_err
@@ -998,7 +999,7 @@
my $p = process()->enable_subreaper;
Mark the current process (not the child) as subreaper.
-This is used typically if you want to mark further childs as subreapers inside
other forks.
+This is used typically if you want to mark further children as subreapers
inside other forks.
my $master_p = process(
sub {
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Mojo-IOLoop-ReadWriteProcess-0.32/t/01_run.t
new/Mojo-IOLoop-ReadWriteProcess-0.33/t/01_run.t
--- old/Mojo-IOLoop-ReadWriteProcess-0.32/t/01_run.t 2021-12-09
19:04:50.000000000 +0100
+++ new/Mojo-IOLoop-ReadWriteProcess-0.33/t/01_run.t 2022-12-12
13:24:02.000000000 +0100
@@ -9,8 +9,8 @@
use IO::Select;
use Mojo::File qw(tempfile path);
use lib ("$FindBin::Bin/lib", "../lib", "lib");
-use Mojo::IOLoop::ReadWriteProcess qw(process);
-use Mojo::IOLoop::ReadWriteProcess::Test::Utils qw(attempt);
+use Mojo::IOLoop::ReadWriteProcess qw(process);
+use Mojo::IOLoop::ReadWriteProcess::Test::Utils qw(attempt check_bin);
subtest process => sub {
@@ -35,7 +35,7 @@
$p->start();
$p->stop();
};
- ok $@, "Error expected";
+ ok $@, "Error expected";
like $@, qr/Nothing to do/,
"Process with no code nor execute command, will fail";
@@ -88,8 +88,8 @@
close(PARENT);
chomp @output;
- is $output[0], "FOOBARFTW", 'right output from process';
- is $p->is_running, 0, "Process now is stopped";
+ is $output[0], "FOOBARFTW", 'right output from process';
+ is $p->is_running, 0, "Process now is stopped";
# Redefine new code and restart it.
pipe(PARENT, CHILD);
@@ -106,8 +106,8 @@
@output = scalar <PARENT>;
$p->stop();
chomp @output;
- is $output[0], "FOOBAZFTW", 'right output from process';
- is $p->is_running, 0, "Process now is not running";
+ is $output[0], "FOOBAZFTW", 'right output from process';
+ is $p->is_running, 0, "Process now is not running";
@output = ('');
pipe(PARENT, CHILD);
@@ -129,24 +129,15 @@
};
subtest 'process execute()' => sub {
- my $test_script = "$FindBin::Bin/data/process_check.sh";
- my $test_script_sigtrap = "$FindBin::Bin/data/term_trap.sh";
- plan skip_all =>
- "You do not seem to have bash, which is required (as for now) for this
test"
- unless -e '/bin/bash';
- plan skip_all =>
-"You do not seem to have $test_script. The script is required to run the test"
- unless -e $test_script;
- plan skip_all =>
-"You do not seem to have $test_script_sigtrap. The script is required to run
the test"
- unless -e $test_script_sigtrap;
- my $p = Mojo::IOLoop::ReadWriteProcess->new(
+ my $test_script = check_bin("$FindBin::Bin/data/process_check.sh");
+ my $test_script_sigtrap = check_bin("$FindBin::Bin/data/term_trap.sh");
+ my $p = Mojo::IOLoop::ReadWriteProcess->new(
sleeptime_during_kill => 0.1,
execute => $test_script
)->start();
is $p->getline, "TEST normal print\n", 'Get right output from stdout';
is $p->err_getline, "TEST error print\n", 'Get right output from stderr';
- is $p->is_running, 1, 'process is still waiting for our input';
+ is $p->is_running, 1, 'process is still waiting for our input';
$p->write("FOOBAR");
is $p->read, "you entered FOOBAR\n",
'process received input and printed it back';
@@ -163,7 +154,7 @@
])->start();
is $p->stdout, "TEST normal print\n", 'Get right output from stdout';
is $p->err_getline, "TEST error print\n", 'Get right output from stderr';
- is $p->is_running, 1, 'process is still waiting for our input';
+ is $p->is_running, 1, 'process is still waiting for our input';
$p->write("FOOBAR");
is $p->getline, "you entered FOOBAR\n",
'process received input and printed it back';
@@ -178,7 +169,7 @@
)->args([qw(FOO BAZ)])->start();
is $p->stdout, "TEST normal print\n", 'Get right output from stdout';
is $p->err_getline, "TEST error print\n", 'Get right output from stderr';
- is $p->is_running, 1, 'process is still waiting for our input';
+ is $p->is_running, 1, 'process is still waiting for our input';
$p->write("FOOBAR");
is $p->getline, "you entered FOOBAR\n",
'process received input and printed it back';
@@ -223,9 +214,10 @@
max_kill_attempts => -4,
); # ;)
$p->start();
+ is($p->read_stdout(), "term_trap.sh started\n");
$p->stop();
- is $p->is_running, 1, 'process is still running';
- is $p->_status, undef, 'no status yet';
+ is $p->is_running, 1, 'process is still running';
+ is $p->_status, undef, 'no status yet';
my $err = ${(@{$p->error})[0]};
my $exp = qr/Could not kill process/;
like $err, $exp, 'Error is not empty if process could not be killed';
@@ -266,8 +258,8 @@
pidfile => $pidfile
)->start();
my $pid = path($pidfile)->slurp();
- is -e $pidfile, 1, 'Pidfile is there!';
- is $pid, $p->pid, "Pidfile was correctly written";
+ is -e $pidfile, 1, 'Pidfile is there!';
+ is $pid, $p->pid, "Pidfile was correctly written";
$p->stop();
is -e $pidfile, undef, 'Pidfile got removed after stop()';
@@ -283,8 +275,8 @@
)->start();
$p->write_pidfile($pidfile);
$pid = path($pidfile)->slurp();
- is -e $pidfile, 1, 'Pidfile is there!';
- is $pid, $p->pid, "Pidfile was correctly written";
+ is -e $pidfile, 1, 'Pidfile is there!';
+ is $pid, $p->pid, "Pidfile was correctly written";
$p->stop();
is -e $pidfile, undef, 'Pidfile got removed after stop()';
@@ -301,10 +293,15 @@
$p->stop();
};
-subtest 'process(execute =>"/usr/bin/true")' => sub {
- plan skip_all => "Missing '/usr/bin/true'" unless -e '/usr/bin/true';
+subtest 'process(execute => /bin/true)' => sub {
+ check_bin('/bin/true');
- is(process(execute =>
'/usr/bin/true')->quirkiness(1)->start()->wait_stop()->exit_status(), 0,
'Simple exec of "/usr/bin/true" return 0');
+ is(
+ process(execute => '/bin/true')->quirkiness(1)->start()->wait_stop()
+ ->exit_status(),
+ 0,
+ 'Simple exec of /bin/true return 0'
+ );
};
subtest 'process code()' => sub {
@@ -464,14 +461,11 @@
$p->write("a");
$p->wait_stop();
like $p->stderr_all, qr/TEST error print/, 'read all from stderr works';
- is $p->read_all, '', 'stdout is empty';
+ is $p->read_all, '', 'stdout is empty';
};
subtest stop_whole_process_group_gracefully => sub {
- my $test_script = "$FindBin::Bin/data/simple_fork.pl";
- plan skip_all =>
- "You do not seem to have $test_script which is required to run the test"
- unless -e $test_script;
+ my $test_script = check_bin("$FindBin::Bin/data/simple_fork.pl");
# run the "term_trap.pl" script and its sub processes within its own
# process group
@@ -546,46 +540,88 @@
subtest 'process_args' => sub {
my $code = sub {
- shift;
- print $_.$/ for(@_);
+ shift;
+ print "$_$/" for @_;
};
- my $p = Mojo::IOLoop::ReadWriteProcess->new($code, args => '0'
)->start->wait_stop();
+ my $p = Mojo::IOLoop::ReadWriteProcess->new($code, args => '0')
+ ->start->wait_stop();
is($p->read_all_stdout(), "0$/", '1) False scalar value was given as args.');
- $p =
Mojo::IOLoop::ReadWriteProcess->new($code)->args('0')->start->wait_stop();
+ $p
+ =
Mojo::IOLoop::ReadWriteProcess->new($code)->args('0')->start->wait_stop();
is($p->read_all_stdout(), "0$/", '2) False scalar value was given as args.');
- $p = Mojo::IOLoop::ReadWriteProcess->new($code, args => [(0..3)]
)->start->wait_stop();
+ $p = Mojo::IOLoop::ReadWriteProcess->new($code, args => [(0 .. 3)])
+ ->start->wait_stop();
is($p->read_all_stdout(), "0$/1$/2$/3$/", '1) Args given as arrayref.');
- $p =
Mojo::IOLoop::ReadWriteProcess->new($code)->args([(0..3)])->start->wait_stop();
+ $p = Mojo::IOLoop::ReadWriteProcess->new($code)->args([(0 .. 3)])
+ ->start->wait_stop();
is($p->read_all_stdout(), "0$/1$/2$/3$/", '2) Args given as arrayref.');
};
subtest 'process in process' => sub {
- my $p = process(sub {
- is( process(execute =>
'/usr/bin/true')->quirkiness(1)->start()->wait_stop()->exit_status(), 0,
'process(execute) from process(code) -- retval check true');
- is( process(execute =>
'/usr/bin/false')->quirkiness(1)->start()->wait_stop()->exit_status(), 1,
'process(execute) from process(code) -- retval check false');
- is( process(sub { print
'sub-sub-process'})->start()->wait_stop()->read_all_stdout, 'sub-sub-process',
'process(code) works from process(code)');
- print 'DONE';
+ check_bin('/bin/true');
+ check_bin('/bin/false');
+
+ my $p = process(
+ sub {
+ is(
+ process(execute => '/bin/true')->quirkiness(1)->start()->wait_stop()
+ ->exit_status(),
+ 0,
+ 'process(execute) from process(code) -- retval check true'
+ );
+ is(
+ process(execute => '/bin/false')->quirkiness(1)->start()->wait_stop()
+ ->exit_status(),
+ 1,
+ 'process(execute) from process(code) -- retval check false'
+ );
+ is(
+ process(sub { print 'sub-sub-process' })->start()->wait_stop()
+ ->read_all_stdout,
+ 'sub-sub-process',
+ 'process(code) works from process(code)'
+ );
+ print 'DONE';
})->start()->wait_stop();
- is ($p->read_all_stdout(), 'DONE', "Use ReadWriteProcess inside of
ReadWriteProcess(code=>'')");
+ is($p->read_all_stdout(), 'DONE',
+ "Use ReadWriteProcess inside of ReadWriteProcess(code=>'')");
};
subtest 'execute exeption handling' => sub {
- throws_ok {
- process(execute =>
'/I/do/not/exist')->start()->wait_stop()->exit_status();
- } qr%/I/do/not/exist%, 'Execute throw exception, if executable does not
exists';
-
- my $p = process(execute => 'sleep 0.2')->start();
- attempt {
- attempts => 20,
- condition => sub { defined($p->exit_status)},
- };
- is ($p->is_running(), 0, 'Process not running');
- is ($p->exit_status(), 0, 'Exit status is 0');
+ throws_ok {
+ process(execute => '/I/do/not/exist')->start()->wait_stop()->exit_status();
+ }
+ qr%/I/do/not/exist%, 'Execute throw exception, if executable does not
exists';
+
+ my $p = process(execute => 'sleep 0.2')->start();
+ attempt {attempts => 20, condition => sub { defined($p->exit_status) },};
+ is($p->is_running(), 0, 'Process not running');
+ is($p->exit_status(), 0, 'Exit status is 0');
+};
+
+subtest 'SIG_CHLD handler in spawned process' => sub {
+ my $simple_rwp = check_bin("$FindBin::Bin/data/simple_rwp.pl");
+ my $sigchld_handler = check_bin("$FindBin::Bin/data/sigchld_handler.pl");
+
+ # use `perl <script>` here, as Github ci action place the used perl
executable
+ # somewhere like /opt/hostedtoolcache/perl/<version>/<arch>/bin/perl so
+ # /usr/bin/perl wouldn't have all needed dependencies
+ is(
+ process(execute => 'perl')->args([$simple_rwp])->start()->wait_stop()
+ ->exit_status(),
+ 0,
+ 'simple_rwp.pl exit with 0'
+ );
+
+ my $p = process(execute => $sigchld_handler);
+ is($p->start()->wait_stop()->exit_status(),
+ 0, 'sigchld_handler.pl exit with 0');
+ like($p->read_all_stdout, qr/SIG_CHLD/, "SIG_CHLD handler was executed");
};
done_testing;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Mojo-IOLoop-ReadWriteProcess-0.32/t/02_parallel.t
new/Mojo-IOLoop-ReadWriteProcess-0.33/t/02_parallel.t
--- old/Mojo-IOLoop-ReadWriteProcess-0.32/t/02_parallel.t 2021-12-09
19:04:50.000000000 +0100
+++ new/Mojo-IOLoop-ReadWriteProcess-0.33/t/02_parallel.t 2022-12-12
13:24:02.000000000 +0100
@@ -62,7 +62,7 @@
$c->each(sub { my $p = shift; $p->wait; is $p->getline(), "Hello world\n";
});
$c->wait_stop;
- is $fired, $n_proc;
+ is $fired, $n_proc;
is scalar(@procs), $n_proc;
$c->add(
@@ -124,7 +124,7 @@
$p->add(sub { print "Hello\n" });
$p->add(sub { print "Wof\n" });
$p->add(sub { print "Wof2\n" });
- is $p->get(1), undef;
+ is $p->get(1), undef;
is $p->size, 1;
is $p->maximum_processes, 1;
};
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Mojo-IOLoop-ReadWriteProcess-0.32/t/03_func.t
new/Mojo-IOLoop-ReadWriteProcess-0.33/t/03_func.t
--- old/Mojo-IOLoop-ReadWriteProcess-0.32/t/03_func.t 2021-12-09
19:04:50.000000000 +0100
+++ new/Mojo-IOLoop-ReadWriteProcess-0.33/t/03_func.t 2022-12-12
13:24:02.000000000 +0100
@@ -7,7 +7,7 @@
use FindBin;
use Mojo::File qw(tempfile path);
use lib ("$FindBin::Bin/lib", "../lib", "lib");
-use Mojo::IOLoop::ReadWriteProcess qw(process queue parallel);
+use Mojo::IOLoop::ReadWriteProcess qw(process queue parallel);
use Mojo::IOLoop::ReadWriteProcess::Test::Utils qw(attempt);
no warnings; # This test mocks a lot
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Mojo-IOLoop-ReadWriteProcess-0.32/t/04_queues.t
new/Mojo-IOLoop-ReadWriteProcess-0.33/t/04_queues.t
--- old/Mojo-IOLoop-ReadWriteProcess-0.32/t/04_queues.t 2021-12-09
19:04:50.000000000 +0100
+++ new/Mojo-IOLoop-ReadWriteProcess-0.33/t/04_queues.t 2022-12-12
13:24:02.000000000 +0100
@@ -36,7 +36,7 @@
is $q->pool->size, 3;
is $q->pool->maximum_processes, 3;
$q->consume;
- is $fired, $proc;
+ is $fired, $proc;
is $q->queue->size, 0;
is $q->pool->size, 0;
is $q->done->size, $proc;
@@ -72,7 +72,7 @@
is $q->pool->size, 2;
is $q->pool->maximum_processes, 2;
$q->consume;
- is $fired, $proc;
+ is $fired, $proc;
is $q->queue->size, 0;
is $q->pool->size, 0;
is $q->done->size, $proc;
@@ -108,7 +108,7 @@
is $q->pool->size, 1;
is $q->pool->maximum_processes, 1;
$q->consume;
- is $fired, $proc;
+ is $fired, $proc;
is $q->queue->size, 0;
is $q->pool->size, 0;
is $q->done->size, $proc;
@@ -147,7 +147,7 @@
is $q->queue->size, 0;
is $q->pool->size, 0;
is $q->done->size, $proc;
- is $fired, $proc;
+ is $fired, $proc;
$i = 1;
for (1 .. $proc) {
is $output{$i + 42}, 1 or diag explain \%output;
@@ -189,7 +189,7 @@
is $q->queue->size, 0;
is $q->pool->size, 0;
is $q->done->size, $proc;
- is $fired, $proc;
+ is $fired, $proc;
$i = 1;
for (1 .. $proc) {
is $output{$i}, 1 or diag explain \%output;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Mojo-IOLoop-ReadWriteProcess-0.32/t/06_events.t
new/Mojo-IOLoop-ReadWriteProcess-0.33/t/06_events.t
--- old/Mojo-IOLoop-ReadWriteProcess-0.32/t/06_events.t 2021-12-09
19:04:50.000000000 +0100
+++ new/Mojo-IOLoop-ReadWriteProcess-0.33/t/06_events.t 2022-12-12
13:24:02.000000000 +0100
@@ -7,18 +7,12 @@
use FindBin;
use Mojo::File qw(tempfile path);
use lib ("$FindBin::Bin/lib", "../lib", "lib");
-use Mojo::IOLoop::ReadWriteProcess qw(process);
-use Mojo::IOLoop::ReadWriteProcess::Session qw(session);
-use Mojo::IOLoop::ReadWriteProcess::Test::Utils qw(attempt);
+use Mojo::IOLoop::ReadWriteProcess qw(process);
+use Mojo::IOLoop::ReadWriteProcess::Session qw(session);
+use Mojo::IOLoop::ReadWriteProcess::Test::Utils qw(attempt check_bin);
subtest SIG_CHLD => sub {
- my $test_script = "$FindBin::Bin/data/process_check.sh";
- plan skip_all =>
- "You do not seem to have bash, which is required (as for now) for this
test"
- unless -e '/bin/bash';
- plan skip_all =>
-"You do not seem to have $test_script. The script is required to run the test"
- unless -e $test_script;
+ my $test_script = check_bin("$FindBin::Bin/data/process_check.sh");
my $reached;
my $collect = 0;
@@ -98,81 +92,74 @@
};
subtest collect_from_signal_handler => sub {
- my $p = process(execute => '/usr/bin/true');
+ check_bin('/bin/true');
+ my $p = process(execute => '/bin/true');
my $collected = 0;
- my $orphan = 0;
- my $sig_chld = 0;
+ my $orphan = 0;
+ my $sig_chld = 0;
$p->session->reset();
- $p->session->collect_status(1); # needed, because previous test set it to 0
- $p->session->on(SIG_CHLD => sub { $sig_chld++});
- $p->session->on(collected => sub { $collected++ });
+ $p->session->collect_status(1); # needed, because previous test set it to 0
+ $p->session->on(SIG_CHLD => sub { $sig_chld++ });
+ $p->session->on(collected => sub { $collected++ });
$p->session->on(collected_orphan => sub { $orphan++ });
$p->start();
attempt {
attempts => 10,
- condition => sub { $sig_chld > 0 && $collected > 0},
+ condition => sub { $sig_chld > 0 && $collected > 0 },
};
- is($sig_chld, 1, "Event for SIG_CHILD was emitted");
+ is($sig_chld, 1, "Event for SIG_CHILD was emitted");
is($collected, 1, "Event collected apear without doing active wait()");
- is($orphan, 0, "No orphans where collected");
+ is($orphan, 0, "No orphans where collected");
$p->wait_stop();
- is($collected, 1, "No more collect events emitted");
- is($orphan, 0, "No more orphans events emitted");
- is($p->exit_status, 0 , '/usr/bin/true exited with 0');
+ is($collected, 1, "No more collect events emitted");
+ is($orphan, 0, "No more orphans events emitted");
+ is($p->exit_status, 0, '/bin/true exited with 0');
- exec ('/usr/bin/true') if (fork() == 0);
+ exec('/bin/true') if (fork() == 0);
- attempt {
- attempts => 10,
- condition => sub { $sig_chld > 1 && $orphan > 0},
- };
+ attempt {attempts => 10, condition => sub { $sig_chld > 1 && $orphan > 0 },};
- is($sig_chld, 2, "Event for SIG_CHILD was emitted");
+ is($sig_chld, 2, "Event for SIG_CHILD was emitted");
is($collected, 1, "No more collect events emitted (2)");
- is($orphan, 1, "Collect one orphan");
+ is($orphan, 1, "Collect one orphan");
};
subtest emit_from_sigchld_off => sub {
- my $p = process(execute => '/usr/bin/true');
+ check_bin('/bin/true');
+ my $p = process(execute => '/bin/true');
my $collected = 0;
- my $orphan = 0;
- my $sig_chld = 0;
+ my $orphan = 0;
+ my $sig_chld = 0;
$p->session->reset();
$p->session->collect_status(1);
$p->session->emit_from_sigchld(0);
- $p->session->on(SIG_CHLD => sub { $sig_chld++});
- $p->session->on(collected => sub { $collected++ });
+ $p->session->on(SIG_CHLD => sub { $sig_chld++ });
+ $p->session->on(collected => sub { $collected++ });
$p->session->on(collected_orphan => sub { $orphan++ });
$p->start();
- attempt {
- attempts => 10,
- condition => sub { $sig_chld > 0},
- };
- is($sig_chld, 1, "Event for SIG_CHILD was emitted");
+ attempt {attempts => 10, condition => sub { $sig_chld > 0 },};
+ is($sig_chld, 1, "Event for SIG_CHILD was emitted");
is($collected, 0, "Event collected didn't appear from sighandler");
- is($orphan, 0, "No orphans where collected");
+ is($orphan, 0, "No orphans where collected");
$p->wait_stop();
- is($collected, 1, "No more collect events emitted");
- is($orphan, 0, "No more orphans events emitted");
- is($p->exit_status, 0 , '/usr/bin/true exited with 0');
+ is($collected, 1, "No more collect events emitted");
+ is($orphan, 0, "No more orphans events emitted");
+ is($p->exit_status, 0, '/bin/true exited with 0');
- exec ('/usr/bin/true') if (fork() == 0);
- attempt {
- attempts => 10,
- condition => sub { $sig_chld > 1},
- };
+ exec('/bin/true') if (fork() == 0);
+ attempt {attempts => 10, condition => sub { $sig_chld > 1 },};
is($collected, 1, "No more collect events emitted (2)");
- is($orphan, 0, "collect_orphan didn't appear from sighandler");
+ is($orphan, 0, "collect_orphan didn't appear from sighandler");
$p->session->consume_collected_info();
- is($sig_chld, 2, "Event for SIG_CHILD was emitted");
+ is($sig_chld, 2, "Event for SIG_CHILD was emitted");
is($collected, 1, "No more collect events emitted (3)");
- is($orphan, 1, "Collect one orphan");
+ is($orphan, 1, "Collect one orphan");
};
done_testing();
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Mojo-IOLoop-ReadWriteProcess-0.32/t/07_autodetect.t
new/Mojo-IOLoop-ReadWriteProcess-0.33/t/07_autodetect.t
--- old/Mojo-IOLoop-ReadWriteProcess-0.32/t/07_autodetect.t 2021-12-09
19:04:50.000000000 +0100
+++ new/Mojo-IOLoop-ReadWriteProcess-0.33/t/07_autodetect.t 2022-12-12
13:24:02.000000000 +0100
@@ -8,7 +8,7 @@
use Mojo::File qw(tempfile path);
use lib ("$FindBin::Bin/lib", "../lib", "lib");
use Mojo::IOLoop::ReadWriteProcess::Test::Utils qw(attempt);
-use Mojo::IOLoop::ReadWriteProcess qw(process);
+use Mojo::IOLoop::ReadWriteProcess qw(process);
use Mojo::IOLoop::ReadWriteProcess::Session;
my $session = Mojo::IOLoop::ReadWriteProcess::Session->singleton;
@@ -47,12 +47,12 @@
};
$p->stop;
- is $status, 1, 'Status fired once';
+ is $status, 1, 'Status fired once';
is $session->all_processes->size, 3, 'detection works' or die diag explain
$p;
ok $session->contains($orphan->pid), 'Orphan collected'
or die diag explain $p->session->all;
ok $session->contains($orphan2->pid), 'Orphan collected';
- ok !$session->contains(99999999), 'Session contain works as expected';
+ ok !$session->contains(99999999), 'Session contain works as expected';
is $fired, 3, 'New subprocess event fired';
is $orphans, 0, 'New subprocess event fired';
@@ -103,8 +103,8 @@
$master_p->stop;
is $master_p->exit_status, 20, 'Correct exit status from master process';
- is $status, 6, 'Status fired 6 times';
- is $fired, 1, 'Status fired 1 times';
+ is $status, 6, 'Status fired 6 times';
+ is $fired, 1, 'Status fired 1 times';
is $session->all->size, 7, 'detection works' or die diag explain $master_p;
@@ -125,8 +125,7 @@
my $sys;
eval {
- $sys
- = $session->_prctl(
+ $sys = $session->_prctl(
Mojo::IOLoop::ReadWriteProcess::Session::PR_SET_CHILD_SUBREAPER(), 1);
};
plan skip_all => "$@ : You do not seem to have subreaper capabilities"
@@ -210,8 +209,7 @@
my $sys;
eval {
- $sys
- = $session->_prctl(
+ $sys = $session->_prctl(
Mojo::IOLoop::ReadWriteProcess::Session::PR_SET_CHILD_SUBREAPER(), 1);
};
plan skip_all => "You do not seem to have subreaper capabilities"
@@ -262,8 +260,7 @@
my $sys;
eval {
- $sys
- = $session->_prctl(
+ $sys = $session->_prctl(
Mojo::IOLoop::ReadWriteProcess::Session::PR_SET_CHILD_SUBREAPER(), 1);
};
plan skip_all => "You do not seem to have subreaper capabilities"
@@ -310,8 +307,7 @@
my $sys;
eval {
- $sys
- = $session->_prctl(
+ $sys = $session->_prctl(
Mojo::IOLoop::ReadWriteProcess::Session::PR_SET_CHILD_SUBREAPER(), 1);
};
plan skip_all => "You do not seem to have subreaper capabilities"
@@ -375,8 +371,7 @@
my $sys;
eval {
- $sys
- = $session->_prctl(
+ $sys = $session->_prctl(
Mojo::IOLoop::ReadWriteProcess::Session::PR_SET_CHILD_SUBREAPER(), 1);
};
plan skip_all => "You do not seem to have subreaper capabilities"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Mojo-IOLoop-ReadWriteProcess-0.32/t/08_ioloop.t
new/Mojo-IOLoop-ReadWriteProcess-0.33/t/08_ioloop.t
--- old/Mojo-IOLoop-ReadWriteProcess-0.32/t/08_ioloop.t 2021-12-09
19:04:50.000000000 +0100
+++ new/Mojo-IOLoop-ReadWriteProcess-0.33/t/08_ioloop.t 2022-12-12
13:24:02.000000000 +0100
@@ -8,7 +8,7 @@
use Mojo::File qw(tempfile path);
use lib ("$FindBin::Bin/lib", "../lib", "lib");
-use Mojo::IOLoop::ReadWriteProcess qw(process);
+use Mojo::IOLoop::ReadWriteProcess qw(process);
use Mojo::IOLoop::ReadWriteProcess::Test::Utils qw(attempt);
use Mojo::IOLoop;
@@ -16,13 +16,13 @@
my $p = process(sub { print "Hello from first process\n"; sleep 1; exit 70
});
- $p->start(); # Start and sets the handlers
+ $p->start(); # Start and sets the handlers
my $stream = $p->to_ioloop; # Get the stream
my $output;
$stream->on(
read => sub { $output .= pop; is $p->is_running, 1, 'Process is running!' }
- ); # Hook on Mojo::IOLoop::Stream events
+ ); # Hook on Mojo::IOLoop::Stream events
Mojo::IOLoop->singleton->start() unless Mojo::IOLoop->singleton->is_running;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Mojo-IOLoop-ReadWriteProcess-0.32/t/09_session.t
new/Mojo-IOLoop-ReadWriteProcess-0.33/t/09_session.t
--- old/Mojo-IOLoop-ReadWriteProcess-0.32/t/09_session.t 2021-12-09
19:04:50.000000000 +0100
+++ new/Mojo-IOLoop-ReadWriteProcess-0.33/t/09_session.t 2022-12-12
13:24:02.000000000 +0100
@@ -8,7 +8,7 @@
use Mojo::File qw(tempfile path);
use lib ("$FindBin::Bin/lib", "../lib", "lib");
-use Mojo::IOLoop::ReadWriteProcess qw(process);
+use Mojo::IOLoop::ReadWriteProcess qw(process);
use Mojo::IOLoop::ReadWriteProcess::Test::Utils qw(attempt);
use Mojo::IOLoop;
@@ -41,7 +41,7 @@
session->unregister(1);
is session->all()->size, 0;
- is session->resolve(1), undef;
+ is session->resolve(1), undef;
session->register(1 => $p);
is session->all()->size, 1;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Mojo-IOLoop-ReadWriteProcess-0.32/t/10_cgroupv1.t
new/Mojo-IOLoop-ReadWriteProcess-0.33/t/10_cgroupv1.t
--- old/Mojo-IOLoop-ReadWriteProcess-0.32/t/10_cgroupv1.t 2021-12-09
19:04:50.000000000 +0100
+++ new/Mojo-IOLoop-ReadWriteProcess-0.33/t/10_cgroupv1.t 2022-12-12
13:24:02.000000000 +0100
@@ -10,7 +10,7 @@
BEGIN { $ENV{MOJO_CGROUP_FS} = tempdir() }
-use Mojo::IOLoop::ReadWriteProcess qw(process);
+use Mojo::IOLoop::ReadWriteProcess qw(process);
use Mojo::IOLoop::ReadWriteProcess::Test::Utils qw(attempt);
use Mojo::IOLoop;
use Mojo::IOLoop::ReadWriteProcess::CGroup qw(cgroupv1);
@@ -22,12 +22,12 @@
my $child_cgroup = $cgroup->child('bar');
$child_cgroup->create();
- ok $child_cgroup->exists, 'Child cgroup exists';
+ ok $child_cgroup->exists, 'Child cgroup exists';
ok -d $child_cgroup->_cgroup, 'Folder is created';
$child_cgroup->remove;
is $child_cgroup->exists, undef, 'Child group does not exist anymore';
- ok $cgroup->exists, 'Parent CGroup exists';
+ ok $cgroup->exists, 'Parent CGroup exists';
ok -d $cgroup->_cgroup, 'Parent CGroup folder exists';
ok $cgroup->_cgroup ne $child_cgroup->_cgroup,
'Child and parent has different CGroup path'
@@ -42,8 +42,8 @@
"procs interface contains the added pids"
or die diag explain $child_cgroup->process_list;
- ok $child_cgroup->contains_process("3"), "Child contains pid 3";
- ok $child_cgroup->contains_process("5"), "Child contains pid 5";
+ ok $child_cgroup->contains_process("3"), "Child contains pid 3";
+ ok $child_cgroup->contains_process("5"), "Child contains pid 5";
ok !$child_cgroup->contains_process("10"), "Child does not contain pid 10";
ok !$child_cgroup->contains_process("20"), "Child does not contain pid 20";
@@ -66,8 +66,8 @@
"thread interface contains the added threads ID"
or die diag explain $cgroup->thread_list;
- ok $cgroup->contains_thread("20"), "Parent contains thread ID 20";
- ok $cgroup->contains_thread("40"), "Parent contains thread ID 40";
+ ok $cgroup->contains_thread("20"), "Parent contains thread ID 20";
+ ok $cgroup->contains_thread("40"), "Parent contains thread ID 40";
ok !$cgroup->contains_thread("30"), "Parent does not contain thread ID 30";
ok !$cgroup->contains_thread("50"), "Parent does not contain thread ID 50";
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Mojo-IOLoop-ReadWriteProcess-0.32/t/10_cgroupv2.t
new/Mojo-IOLoop-ReadWriteProcess-0.33/t/10_cgroupv2.t
--- old/Mojo-IOLoop-ReadWriteProcess-0.32/t/10_cgroupv2.t 2021-12-09
19:04:50.000000000 +0100
+++ new/Mojo-IOLoop-ReadWriteProcess-0.33/t/10_cgroupv2.t 2022-12-12
13:24:02.000000000 +0100
@@ -10,7 +10,7 @@
BEGIN { $ENV{MOJO_CGROUP_FS} = tempdir() }
-use Mojo::IOLoop::ReadWriteProcess qw(process);
+use Mojo::IOLoop::ReadWriteProcess qw(process);
use Mojo::IOLoop::ReadWriteProcess::Test::Utils qw(attempt);
use Mojo::IOLoop;
use Mojo::IOLoop::ReadWriteProcess::CGroup qw(cgroupv2);
@@ -22,12 +22,12 @@
my $child_cgroup = $cgroup->child('bar');
$child_cgroup->create();
- ok $child_cgroup->exists, 'Child cgroup exists';
+ ok $child_cgroup->exists, 'Child cgroup exists';
ok -d $child_cgroup->_cgroup, 'Folder is created';
$child_cgroup->remove;
is $child_cgroup->exists, undef, 'Child group does not exist anymore';
- ok $cgroup->exists, 'Parent CGroup exists';
+ ok $cgroup->exists, 'Parent CGroup exists';
ok -d $cgroup->_cgroup, 'Parent CGroup folder exists';
ok $cgroup->_cgroup ne $child_cgroup->_cgroup,
'Child and parent has different CGroup path'
@@ -42,8 +42,8 @@
"procs interface contains the added pids"
or die diag explain $child_cgroup->process_list;
- ok $child_cgroup->contains_process("3"), "Child contains pid 3";
- ok $child_cgroup->contains_process("5"), "Child contains pid 5";
+ ok $child_cgroup->contains_process("3"), "Child contains pid 3";
+ ok $child_cgroup->contains_process("5"), "Child contains pid 5";
ok !$child_cgroup->contains_process("10"), "Child does not contain pid 10";
ok !$child_cgroup->contains_process("20"), "Child does not contain pid 20";
@@ -79,8 +79,8 @@
"thread interface contains the added threads ID"
or die diag explain $cgroup->thread_list;
- ok $cgroup->contains_thread("20"), "Parent contains thread ID 20";
- ok $cgroup->contains_thread("40"), "Parent contains thread ID 40";
+ ok $cgroup->contains_thread("20"), "Parent contains thread ID 20";
+ ok $cgroup->contains_thread("40"), "Parent contains thread ID 40";
ok !$cgroup->contains_thread("30"), "Parent does not contain thread ID 30";
ok !$cgroup->contains_thread("50"), "Parent does not contain thread ID 50";
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Mojo-IOLoop-ReadWriteProcess-0.32/t/11_containers.t
new/Mojo-IOLoop-ReadWriteProcess-0.33/t/11_containers.t
--- old/Mojo-IOLoop-ReadWriteProcess-0.32/t/11_containers.t 2021-12-09
19:04:50.000000000 +0100
+++ new/Mojo-IOLoop-ReadWriteProcess-0.33/t/11_containers.t 2022-12-12
13:24:02.000000000 +0100
@@ -8,10 +8,10 @@
use Mojo::File qw(tempfile tempdir path);
use lib ("$FindBin::Bin/lib", "../lib", "lib");
-use Mojo::IOLoop::ReadWriteProcess qw(process);
+use Mojo::IOLoop::ReadWriteProcess qw(process);
use Mojo::IOLoop::ReadWriteProcess::Test::Utils qw(attempt);
-use Mojo::IOLoop::ReadWriteProcess::CGroup qw(cgroupv2 cgroupv1);
-use Mojo::IOLoop::ReadWriteProcess::Container qw(container);
+use Mojo::IOLoop::ReadWriteProcess::CGroup qw(cgroupv2 cgroupv1);
+use Mojo::IOLoop::ReadWriteProcess::Container qw(container);
eval {
my $try_cgroup
@@ -54,7 +54,7 @@
};
-subtest childs => sub {
+subtest children => sub {
my $cgroup = cgroupv1(controller => 'pids', name => 'group')->child('test');
isa_ok $cgroup, 'Mojo::IOLoop::ReadWriteProcess::CGroup::v1';
is $cgroup->exists(), 1, 'Cgroup exists';
@@ -233,7 +233,7 @@
$c->stop();
is $cgroup->processes->size, 0;
- is $cgroup->process_list, '' or die diag explain $cgroup->process_list;
+ is $cgroup->process_list, '' or die diag explain $cgroup->process_list;
$cgroup->remove();
is scalar(@pids), 5 or diag explain \@pids;
isnt $virtual_pid, '1',
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/Mojo-IOLoop-ReadWriteProcess-0.32/t/12_mocked_container.t
new/Mojo-IOLoop-ReadWriteProcess-0.33/t/12_mocked_container.t
--- old/Mojo-IOLoop-ReadWriteProcess-0.32/t/12_mocked_container.t
2021-12-09 19:04:50.000000000 +0100
+++ new/Mojo-IOLoop-ReadWriteProcess-0.33/t/12_mocked_container.t
2022-12-12 13:24:02.000000000 +0100
@@ -10,10 +10,10 @@
BEGIN { $ENV{MOJO_CGROUP_FS} = tempdir() }
-use Mojo::IOLoop::ReadWriteProcess qw(process);
+use Mojo::IOLoop::ReadWriteProcess qw(process);
use Mojo::IOLoop::ReadWriteProcess::Test::Utils qw(attempt);
-use Mojo::IOLoop::ReadWriteProcess::CGroup qw(cgroupv2 cgroupv1);
-use Mojo::IOLoop::ReadWriteProcess::Container qw(container);
+use Mojo::IOLoop::ReadWriteProcess::CGroup qw(cgroupv2 cgroupv1);
+use Mojo::IOLoop::ReadWriteProcess::Container qw(container);
use Mojo::Util 'monkey_patch';
use Mojo::IOLoop::ReadWriteProcess::Namespace;
@@ -51,8 +51,8 @@
is $cgroups->first->process_list, $p->pid . "\n"
or die diag explain $cgroups->first->process_list;
- unlink $cgroups->first->_cgroup
- ->child(Mojo::IOLoop::ReadWriteProcess::CGroup::v1::PROCS_INTERFACE);
+ unlink $cgroups->first->_cgroup->child(
+ Mojo::IOLoop::ReadWriteProcess::CGroup::v1::PROCS_INTERFACE);
$cgroups->first->remove();
ok !$cgroups->first->exists();
is $fired, 1;
@@ -69,7 +69,7 @@
subreaper => 1,
group => "group",
name => "test",
- process =>
+ process =>
sub { sleep 5; Devel::Cover::report() if Devel::Cover->can('report'); },
);
@@ -98,8 +98,8 @@
is $cgroups->first->process_list, $p->pid . "\n"
or die diag explain $cgroups->first->process_list;
- unlink $cgroups->first->_cgroup
- ->child(Mojo::IOLoop::ReadWriteProcess::CGroup::v1::PROCS_INTERFACE);
+ unlink $cgroups->first->_cgroup->child(
+ Mojo::IOLoop::ReadWriteProcess::CGroup::v1::PROCS_INTERFACE);
$cgroups->first->remove();
ok !$cgroups->first->exists();
is $fired, 1;
@@ -140,8 +140,8 @@
is $cgroups->first->process_list, $p->pid . "\n"
or die diag explain $cgroups->first->process_list;
- unlink $cgroups->first->_cgroup
- ->child(Mojo::IOLoop::ReadWriteProcess::CGroup::v1::PROCS_INTERFACE);
+ unlink $cgroups->first->_cgroup->child(
+ Mojo::IOLoop::ReadWriteProcess::CGroup::v1::PROCS_INTERFACE);
$cgroups->first->remove();
ok !$cgroups->first->exists();
is $fired, 1;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/Mojo-IOLoop-ReadWriteProcess-0.32/t/data/sigchld_handler.pl
new/Mojo-IOLoop-ReadWriteProcess-0.33/t/data/sigchld_handler.pl
--- old/Mojo-IOLoop-ReadWriteProcess-0.32/t/data/sigchld_handler.pl
1970-01-01 01:00:00.000000000 +0100
+++ new/Mojo-IOLoop-ReadWriteProcess-0.33/t/data/sigchld_handler.pl
2022-12-12 13:24:02.000000000 +0100
@@ -0,0 +1,20 @@
+#!/usr/bin/perl
+use warnings;
+use strict;
+use Time::HiRes 'sleep';
+
+my $collected_pid = -1;
+$SIG{CHLD} = sub {
+ $collected_pid = waitpid(-1, 0);
+ print "SIG_CHLD $collected_pid exit:" . ($? >> 8) . "\n";
+};
+
+my $pid = fork();
+if ($pid == 0) {
+ print "I'm the child $$\n";
+ exit 0;
+}
+print "Forked child is $pid\n";
+sleep 0.1 while ($collected_pid != $pid);
+print "Exit graceful\n";
+exit 0;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/Mojo-IOLoop-ReadWriteProcess-0.32/t/data/simple_rwp.pl
new/Mojo-IOLoop-ReadWriteProcess-0.33/t/data/simple_rwp.pl
--- old/Mojo-IOLoop-ReadWriteProcess-0.32/t/data/simple_rwp.pl 1970-01-01
01:00:00.000000000 +0100
+++ new/Mojo-IOLoop-ReadWriteProcess-0.33/t/data/simple_rwp.pl 2022-12-12
13:24:02.000000000 +0100
@@ -0,0 +1,6 @@
+#!/usr/bin/perl
+use FindBin;
+use lib ("$FindBin::Bin/../../lib");
+use Mojo::IOLoop::ReadWriteProcess 'process';
+
+exit process(execute => '/bin/true')->start()->wait_stop()->exit_status();
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/Mojo-IOLoop-ReadWriteProcess-0.32/t/data/term_trap.sh
new/Mojo-IOLoop-ReadWriteProcess-0.33/t/data/term_trap.sh
--- old/Mojo-IOLoop-ReadWriteProcess-0.32/t/data/term_trap.sh 2021-12-09
19:04:50.000000000 +0100
+++ new/Mojo-IOLoop-ReadWriteProcess-0.33/t/data/term_trap.sh 2022-12-12
13:24:02.000000000 +0100
@@ -1,6 +1,7 @@
#!/bin/bash
-(sleep 25; echo "Hello World") &
trap "echo I ALWAYS WIN" SIGINT SIGTERM
+echo "term_trap.sh started"
+(sleep 25; echo "Hello World") &
echo "pid is $$"
while :
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/Mojo-IOLoop-ReadWriteProcess-0.32/t/lib/Mojo/IOLoop/ReadWriteProcess/Test/Utils.pm
new/Mojo-IOLoop-ReadWriteProcess-0.33/t/lib/Mojo/IOLoop/ReadWriteProcess/Test/Utils.pm
---
old/Mojo-IOLoop-ReadWriteProcess-0.32/t/lib/Mojo/IOLoop/ReadWriteProcess/Test/Utils.pm
2021-12-09 19:04:50.000000000 +0100
+++
new/Mojo-IOLoop-ReadWriteProcess-0.33/t/lib/Mojo/IOLoop/ReadWriteProcess/Test/Utils.pm
2022-12-12 13:24:02.000000000 +0100
@@ -1,15 +1,17 @@
package Mojo::IOLoop::ReadWriteProcess::Test::Utils;
-our @EXPORT_OK = qw(attempt);
+our @EXPORT_OK = qw(attempt check_bin);
use Time::HiRes qw(sleep);
use Exporter 'import';
+use Test::More;
+use Mojo::File qw(path);
use constant DEBUG => $ENV{MOJO_PROCESS_DEBUG};
sub attempt {
my $attempts = 0;
my ($total_attempts, $condition, $cb, $or)
= ref $_[0] eq 'HASH' ? (@{$_[0]}{qw(attempts condition cb or)}) : @_;
- $cb //= sub {1};
+ $cb //= sub { 1 };
until ($condition->() || $attempts >= $total_attempts) {
warn "Attempt $attempts" if DEBUG;
$cb->();
@@ -20,5 +22,20 @@
warn "Attempts terminated!" if DEBUG;
}
+sub check_bin {
+ my $script = shift;
+
+ plan skip_all =>
+ "You do not seem to have $script. The script is required to run the test"
+ unless -e $script;
+
+ if (-T $script) {
+ my ($shebang) = path($script)->slurp =~ m/^#!(\S+)/;
+ plan skip_all =>
+ "You do not seem to have $shebang wich is required for $script"
+ if ($shebang && !-e $shebang);
+ }
+ return $script;
+}
1;