Skip to content

Commit 990f2d3

Browse files
committed
Expose Process#spawn.
1 parent 687a394 commit 990f2d3

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

lib/async/container/notify/server.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ module Async
1111
module Container
1212
module Notify
1313
class Server
14-
NOTIFY_SOCKET = "NOTIFY_SOCKET"
1514
MAXIMUM_MESSAGE_SIZE = 4096
1615

1716
def self.load(message)

lib/async/container/process.rb

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -84,15 +84,13 @@ def self.fork(**options)
8484
end
8585
end
8686

87-
# def self.spawn(*arguments, name: nil, **options)
88-
# self.new(name: name) do |process|
89-
# unless options.key?(:out)
90-
# options[:out] = process.out
91-
# end
92-
#
93-
# ::Process.spawn(*arguments, **options)
94-
# end
95-
# end
87+
def self.spawn(*arguments, name: nil, **options)
88+
self.new(name: name) do |process|
89+
Notify::Pipe.new(process.out).before_spawn(arguments, options)
90+
91+
::Process.spawn(*arguments, **options)
92+
end
93+
end
9694

9795
# Initialize the process.
9896
# @parameter name [String] The name to use for the child process.
@@ -122,6 +120,9 @@ def name= value
122120
# @attribute [String]
123121
attr :name
124122

123+
# @attribute [Integer] The process identifier.
124+
attr :pid
125+
125126
# A human readable representation of the process.
126127
# @returns [String]
127128
def inspect

0 commit comments

Comments
 (0)