File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2828 ScratchPad . recorded . should == [ "hello\n " , "line2\n " ]
2929 end
3030
31- platform_is_not :windows do
31+ guard -> { Process . respond_to? ( :fork ) } do
3232 it "gets data from a fork when passed -" do
3333 parent_pid = $$
3434
Original file line number Diff line number Diff line change 163163 end
164164 end
165165
166- platform_is_not :windows do
166+ guard -> { Process . respond_to? ( :fork ) } do
167167 it "opens a pipe to a fork if the rest is -" do
168168 str = nil
169169 suppress_warning do # https://bugs.ruby-lang.org/issues/19630
Original file line number Diff line number Diff line change 189189 lines . should == [ "hello\n " , "line2\n " ]
190190 end
191191
192- platform_is_not :windows do
192+ guard -> { Process . respond_to? ( :fork ) } do
193193 it "gets data from a fork when passed -" do
194194 lines = nil
195195 suppress_warning do # https://bugs.ruby-lang.org/issues/19630
Original file line number Diff line number Diff line change 11require_relative '../../spec_helper'
22require_relative 'fixtures/common'
33
4- platform_is_not :windows do
5- # macOS 15 is not working this examples
6- return if /darwin/ =~ RUBY_PLATFORM && /15/ =~ `sw_vers -productVersion`
7-
4+ guard -> {
5+ Process . respond_to? ( :fork ) and
6+ # macOS 15 is not working for these examples
7+ !( /darwin/ =~ RUBY_PLATFORM && /15/ =~ `sw_vers -productVersion` )
8+ } do
89 describe :process_daemon_keep_stdio_open_false , shared : true do
910 it "redirects stdout to /dev/null" do
1011 @daemon . invoke ( "keep_stdio_open_false_stdout" , @object ) . should == ""
107108 end
108109end
109110
110- platform_is :windows do
111+ guard_not -> { Process . respond_to? ( :fork ) } do
111112 describe "Process.daemon" do
113+ it "returns false from #respond_to?" do
114+ Process . respond_to? ( :daemon ) . should == false
115+ end
116+
112117 it "raises a NotImplementedError" do
113118 -> {
114119 Process . daemon
Original file line number Diff line number Diff line change 11require_relative '../../spec_helper'
22
33describe "Process.setpgid" do
4- platform_is_not :windows do
4+ guard -> { Process . respond_to? ( :fork ) } do
55 # Must use fork as setpgid(2) gives EACCESS after execve()
66 it "sets the process group id of the specified process" do
77 rd , wr = IO . pipe
Original file line number Diff line number Diff line change 22
33# TODO: put these in the right files.
44describe "Process.setpgrp and Process.getpgrp" do
5- platform_is_not :windows do
5+ guard -> { Process . respond_to? ( :fork ) } do
66 it "sets and gets the process group ID of the calling process" do
77 # there are two synchronization points here:
88 # One for the child to let the parent know that it has finished
Original file line number Diff line number Diff line change 7070 end
7171
7272 # This spec is probably system-dependent.
73- it "doesn't block if no child is available when WNOHANG is used" do
74- read , write = IO . pipe
75- pid = Process . fork do
76- read . close
77- Signal . trap ( "TERM" ) { Process . exit! }
78- write << 1
73+ guard -> { Process . respond_to? ( :fork ) } do
74+ it "doesn't block if no child is available when WNOHANG is used" do
75+ read , write = IO . pipe
76+ pid = Process . fork do
77+ read . close
78+ Signal . trap ( "TERM" ) { Process . exit! }
79+ write << 1
80+ write . close
81+ sleep
82+ end
83+
84+ Process ::Status . wait ( pid , Process ::WNOHANG ) . should == nil
85+
86+ # wait for the child to setup its TERM handler
7987 write . close
80- sleep
81- end
82-
83- Process ::Status . wait ( pid , Process ::WNOHANG ) . should == nil
84-
85- # wait for the child to setup its TERM handler
86- write . close
87- read . read ( 1 )
88- read . close
88+ read . read ( 1 )
89+ read . close
8990
90- Process . kill ( "TERM" , pid )
91- Process ::Status . wait . pid . should == pid
91+ Process . kill ( "TERM" , pid )
92+ Process ::Status . wait . pid . should == pid
93+ end
9294 end
9395
9496 it "always accepts flags=0" do
Original file line number Diff line number Diff line change 11describe :process_fork , shared : true do
2- platform_is :windows do
2+ guard_not -> { Process . respond_to? ( :fork ) } do
33 it "returns false from #respond_to?" do
44 # Workaround for Kernel::Method being public and losing the "non-respond_to? magic"
55 mod = @object . class . name == "KernelSpecs::Method" ? Object . new : @object
1212 end
1313 end
1414
15- platform_is_not :windows do
15+ guard -> { Process . respond_to? ( :fork ) } do
1616 before :each do
1717 @file = tmp ( 'i_exist' )
1818 rm_r @file
You can’t perform that action at this time.
0 commit comments