Skip to content

Commit

Permalink
RDoc for Open3
Browse files Browse the repository at this point in the history
  • Loading branch information
BurdetteLamar committed Nov 20, 2023
1 parent aa8aa50 commit 85a7799
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions lib/open3.rb
Original file line number Diff line number Diff line change
Expand Up @@ -929,19 +929,21 @@ def capture2e(*cmd)
# the +stdout+ stream of the last child,
# and an array of the wait processes:
#
# Open3.pipeline_rw("sort", "cat -n") do |first_stdin, last_stdout, ts|
# Open3.pipeline_rw("sort", "cat -n") do |first_stdin, last_stdout, wait_threads|
# first_stdin.puts "foo"
# first_stdin.puts "bar"
# first_stdin.puts "baz"
# first_stdin.close # send EOF to sort.
# puts last_stdout.read
# p wait_threads
# end
#
# Output:
#
# 1 bar
# 2 baz
# 3 foo
# [#<Process::Waiter:0x000055f57082bc00 dead>, #<Process::Waiter:0x000055f57082b7c8 dead>]
#
# Like Process.spawn, this method has potential security vulnerabilities
# if called with untrusted input;
Expand Down Expand Up @@ -1011,9 +1013,9 @@ def pipeline_rw(*cmds, &block)
# of the last child process,
# and an array of the wait processes:
#
# Open3.pipeline_r('ls', 'grep R') do |last_stdout, ts|
# Open3.pipeline_r('ls', 'grep R') do |last_stdout, wait_threads|
# puts last_stdout.read
# p ts
# p wait_threads
# end
#
# Output:
Expand Down Expand Up @@ -1093,9 +1095,9 @@ def pipeline_r(*cmds, &block)
# Open3.pipeline_r(
# ['ruby', '-e', 'print "Foo"'],
# ['ruby', '-e', 'print STDIN.read + "Bar"']
# ) do |first_stdin, ts|
# ) do |first_stdin, wait_threads|
# puts first_stdin.read
# p ts
# p wait_threads
# end
#
# Output:
Expand Down Expand Up @@ -1164,8 +1166,8 @@ def pipeline_w(*cmds, &block)
# of the last child process,
# and an array of the wait processes:
#
# Open3.pipeline_start("sort", "cat -n") do |ts|
# p ts
# Open3.pipeline_start("sort", "cat -n") do |wait_threads|
# p wait_threads
# end
#
# Output:
Expand Down

0 comments on commit 85a7799

Please sign in to comment.