File tree Expand file tree Collapse file tree 1 file changed +10
-4
lines changed Expand file tree Collapse file tree 1 file changed +10
-4
lines changed Original file line number Diff line number Diff line change 44
44
end
45
45
46
46
it "tolerates not existing child process pid" do
47
- # ensure there is no child process with this hardcoded pid
48
- # `kill 0 pid` for existing process returns "1" and raises Errno::ESRCH if process doesn't exist
49
- -> { Process . kill ( 0 , 100500 ) } . should raise_error ( Errno :: ESRCH )
47
+ # Use a value that is close to the INT_MAX ( pid usually is signed int).
48
+ # It should (at least) be greater than allowed pid limit value that depends on OS.
49
+ pid_not_existing = 2 . pow ( 30 )
50
50
51
- thr = Process . detach ( 100500 )
51
+ # Check that there is no a child process with this hardcoded pid.
52
+ # Command `kill 0 pid`:
53
+ # - returns "1" if a process exists and
54
+ # - raises Errno::ESRCH otherwise
55
+ -> { Process . kill ( 0 , pid_not_existing ) } . should raise_error ( Errno ::ESRCH )
56
+
57
+ thr = Process . detach ( pid_not_existing )
52
58
thr . join
53
59
54
60
thr . should be_kind_of ( Thread )
You can’t perform that action at this time.
0 commit comments