mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Fix spawn_spec.rb for Travis arm64 environment.
The process group id (/proc/[pid]/stat 5th field) is 0 in the Travis arm64 environment. This is a case where it is available. $ cat /proc/4543/stat 4543 (ruby) S 4525 4525 1384 34818 4525 4194304 37443 1754841 0 0 366 105 2291 391 20 0 3 0 1381328 1428127744 11475 18446744073709551615 94195983785984 94195986670225 140728933833312 0 0 0 0 0 1107394127 0 0 0 17 2 0 0 1 0 0 94195987686512 94195987708942 94196017770496 140728933835483 140728933835595 140728933835595 140728933842904 0 This is a case where it is not available in Travis arm64 environment. $ cat /proc/19179/stat 19179 (ruby) S 19160 0 0 0 -1 4194560 37618 1710547 313 163 770 665 5206 1439 20 0 2 0 17529566 1196347392 10319 18446744073709551615 187650811428864 187650815023116 281474602721280 0 0 0 0 4096 1107390031 0 0 0 17 22 0 0 0 0 0 187650815091456 187650815114064 187651414974464 281474602725080 281474602725211 281474602725211 281474602729420 0 See "man proc" for detail.
This commit is contained in:
parent
2fd465540f
commit
f5c7fc495a
Notes:
git
2019-11-07 02:09:13 +09:00
1 changed files with 13 additions and 3 deletions
|
@ -331,9 +331,19 @@ describe "Process.spawn" do
|
|||
|
||||
it "joins the specified process group if pgroup: pgid" do
|
||||
pgid = Process.getpgid(Process.pid)
|
||||
-> do
|
||||
Process.wait Process.spawn(ruby_cmd("print Process.getpgid(Process.pid)"), pgroup: pgid)
|
||||
end.should output_to_fd(pgid.to_s)
|
||||
# The process group is not available on all platforms.
|
||||
# See "man proc" - /proc/[pid]/stat - (5) pgrp
|
||||
# In Travis arm64 environment, the value is 0.
|
||||
#
|
||||
# $ cat /proc/[pid]/stat
|
||||
# 19179 (ruby) S 19160 0 0 ...
|
||||
unless pgid.zero?
|
||||
-> do
|
||||
Process.wait Process.spawn(ruby_cmd("print Process.getpgid(Process.pid)"), pgroup: pgid)
|
||||
end.should output_to_fd(pgid.to_s)
|
||||
else
|
||||
skip "The process group is not available."
|
||||
end
|
||||
end
|
||||
|
||||
it "raises an ArgumentError if given a negative :pgroup option" do
|
||||
|
|
Loading…
Reference in a new issue