Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DOC] Rdoc tweaks #22

Merged
merged 2 commits into from
Nov 22, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
102 changes: 72 additions & 30 deletions lib/open3.rb
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,11 @@
# Each of the methods above accepts:
#
# - An optional hash of environment variable names and values;
# see {Execution Environment}[https://docs.ruby-lang.org/en/master/Process.html#Execution+Environment].
# see {Execution Environment}[https://docs.ruby-lang.org/en/master/Process.html#module-Process-label-Execution+Environment].
# - A required string argument that is a +command_line+ or +exe_path+;
# see {Argument command_line or exe_path}[https://docs.ruby-lang.org/en/master/Process.html#Argument+command_line+or+exe_path].
# see {Argument command_line or exe_path}[https://docs.ruby-lang.org/en/master/Process.html#module-Process-label-Argument+command_line+or+exe_path].
# - An optional hash of execution options;
# see {Execution Options}[https://docs.ruby-lang.org/en/master/Process.html#Execution+Options].
# see {Execution Options}[https://docs.ruby-lang.org/en/master/Process.html#module-Process-label-Execution+Options].
#
module Open3

Expand Down Expand Up @@ -135,13 +135,18 @@ module Open3
#
# Like Process.spawn, this method has potential security vulnerabilities
# if called with untrusted input;
# see {Command Injection}[rdoc-ref:command_injection.rdoc].
# see {Command Injection}[https://docs.ruby-lang.org/en/master/command_injection_rdoc.html#label-Command+Injection].
#
# Unlike Process.spawn, this method waits for the child process to exit
# before returning, so the caller need not do so.
#
# Argument +options+ is a hash of options for the new process;
# see {Execution Options}[rdoc-ref:Process@Execution+Options].
# If the first argument is a hash, it becomes leading argument +env+
# in the call to Process.spawn;
# see {Execution Environment}[https://docs.ruby-lang.org/en/master/Process.html#module-Process-label-Execution+Environment].
#
# If the last argument is a hash, it becomes trailing argument +options+
# in the call to Process.spawn;
# see {Execution Options}[https://docs.ruby-lang.org/en/master/Process.html#module-Process-label-Execution+Options].
#
# The single required argument is one of the following:
#
Expand Down Expand Up @@ -283,13 +288,18 @@ def popen3(*cmd, &block)
#
# Like Process.spawn, this method has potential security vulnerabilities
# if called with untrusted input;
# see {Command Injection}[rdoc-ref:command_injection.rdoc].
# see {Command Injection}[https://docs.ruby-lang.org/en/master/command_injection_rdoc.html#label-Command+Injection].
#
# Unlike Process.spawn, this method waits for the child process to exit
# before returning, so the caller need not do so.
#
# Argument +options+ is a hash of options for the new process;
# see {Execution Options}[rdoc-ref:Process@Execution+Options].
# If the first argument is a hash, it becomes leading argument +env+
# in the call to Process.spawn;
# see {Execution Environment}[https://docs.ruby-lang.org/en/master/Process.html#module-Process-label-Execution+Environment].
#
# If the last argument is a hash, it becomes trailing argument +options+
# in the call to Process.spawn;
# see {Execution Options}[https://docs.ruby-lang.org/en/master/Process.html#module-Process-label-Execution+Options].
#
# The single required argument is one of the following:
#
Expand Down Expand Up @@ -422,13 +432,18 @@ def popen2(*cmd, &block)
#
# Like Process.spawn, this method has potential security vulnerabilities
# if called with untrusted input;
# see {Command Injection}[rdoc-ref:command_injection.rdoc].
# see {Command Injection}[https://docs.ruby-lang.org/en/master/command_injection_rdoc.html#label-Command+Injection].
#
# Unlike Process.spawn, this method waits for the child process to exit
# before returning, so the caller need not do so.
#
# Argument +options+ is a hash of options for the new process;
# see {Execution Options}[rdoc-ref:Process@Execution+Options].
# If the first argument is a hash, it becomes leading argument +env+
# in the call to Process.spawn;
# see {Execution Environment}[https://docs.ruby-lang.org/en/master/Process.html#module-Process-label-Execution+Environment].
#
# If the last argument is a hash, it becomes trailing argument +options+
# in the call to Process.spawn;
# see {Execution Options}[https://docs.ruby-lang.org/en/master/Process.html#module-Process-label-Execution+Options].
#
# The single required argument is one of the following:
#
Expand Down Expand Up @@ -555,15 +570,20 @@ class << self
#
# Like Process.spawn, this method has potential security vulnerabilities
# if called with untrusted input;
# see {Command Injection}[rdoc-ref:command_injection.rdoc].
# see {Command Injection}[https://docs.ruby-lang.org/en/master/command_injection_rdoc.html#label-Command+Injection].
#
# Unlike Process.spawn, this method waits for the child process to exit
# before returning, so the caller need not do so.
#
# Argument +options+ is a hash of options for the new process;
# see {Execution Options}[rdoc-ref:Process@Execution+Options].
# If the first argument is a hash, it becomes leading argument +env+
# in the call to Open3.popen3;
# see {Execution Environment}[https://docs.ruby-lang.org/en/master/Process.html#module-Process-label-Execution+Environment].
#
# The hash +options+ is passed to method Open3.popen3;
# If the last argument is a hash, it becomes trailing argument +options+
# in the call to Open3.popen3;
# see {Execution Options}[https://docs.ruby-lang.org/en/master/Process.html#module-Process-label-Execution+Options].
#
# The hash +options+ is given;
# two options have local effect in method Open3.capture3:
#
# - If entry <tt>options[:stdin_data]</tt> exists, the entry is removed
Expand All @@ -572,7 +592,7 @@ class << self
# Open3.capture3('tee', stdin_data: 'Foo')
# # => ["Foo", "", #<Process::Status: pid 2319575 exit 0>]
#
# - If entry <tt>options[:binmode]</tt> exists, the entry is removed
# - If entry <tt>options[:binmode]</tt> exists, the entry is removed and
# the internal streams are set to binary mode.
#
# The single required argument is one of the following:
Expand Down Expand Up @@ -676,15 +696,20 @@ def capture3(*cmd)
#
# Like Process.spawn, this method has potential security vulnerabilities
# if called with untrusted input;
# see {Command Injection}[rdoc-ref:command_injection.rdoc].
# see {Command Injection}[https://docs.ruby-lang.org/en/master/command_injection_rdoc.html#label-Command+Injection].
#
# Unlike Process.spawn, this method waits for the child process to exit
# before returning, so the caller need not do so.
#
# Argument +options+ is a hash of options for the new process;
# see {Execution Options}[rdoc-ref:Process@Execution+Options].
# If the first argument is a hash, it becomes leading argument +env+
# in the call to Open3.popen3;
# see {Execution Environment}[https://docs.ruby-lang.org/en/master/Process.html#module-Process-label-Execution+Environment].
#
# The hash +options+ is passed to method Open3.popen3;
# If the last argument is a hash, it becomes trailing argument +options+
# in the call to Open3.popen3;
# see {Execution Options}[https://docs.ruby-lang.org/en/master/Process.html#module-Process-label-Execution+Options].
#
# The hash +options+ is given;
# two options have local effect in method Open3.capture2:
#
# - If entry <tt>options[:stdin_data]</tt> exists, the entry is removed
Expand All @@ -694,6 +719,7 @@ def capture3(*cmd)
#
# # => ["Foo", #<Process::Status: pid 2326087 exit 0>]
#
# - If entry <tt>options[:binmode]</tt> exists, the entry is removed and
# the internal streams are set to binary mode.
#
# The single required argument is one of the following:
Expand Down Expand Up @@ -798,15 +824,20 @@ def capture2(*cmd)
#
# Like Process.spawn, this method has potential security vulnerabilities
# if called with untrusted input;
# see {Command Injection}[rdoc-ref:command_injection.rdoc].
# see {Command Injection}[https://docs.ruby-lang.org/en/master/command_injection_rdoc.html#label-Command+Injection].
#
# Unlike Process.spawn, this method waits for the child process to exit
# before returning, so the caller need not do so.
#
# Argument +options+ is a hash of options for the new process;
# see {Execution Options}[rdoc-ref:Process@Execution+Options].
# If the first argument is a hash, it becomes leading argument +env+
# in the call to Open3.popen3;
# see {Execution Environment}[https://docs.ruby-lang.org/en/master/Process.html#module-Process-label-Execution+Environment].
#
# The hash +options+ is passed to method Open3.popen3;
# If the last argument is a hash, it becomes trailing argument +options+
# in the call to Open3.popen3;
# see {Execution Options}[https://docs.ruby-lang.org/en/master/Process.html#module-Process-label-Execution+Options].
#
# The hash +options+ is given;
# two options have local effect in method Open3.capture2e:
#
# - If entry <tt>options[:stdin_data]</tt> exists, the entry is removed
Expand All @@ -815,6 +846,7 @@ def capture2(*cmd)
# Open3.capture2e('tee', stdin_data: 'Foo')
# # => ["Foo", #<Process::Status: pid 2371732 exit 0>]
#
# - If entry <tt>options[:binmode]</tt> exists, the entry is removed and
# the internal streams are set to binary mode.
#
# The single required argument is one of the following:
Expand Down Expand Up @@ -959,7 +991,7 @@ def capture2e(*cmd)
#
# Like Process.spawn, this method has potential security vulnerabilities
# if called with untrusted input;
# see {Command Injection}[rdoc-ref:command_injection.rdoc].
# see {Command Injection}[https://docs.ruby-lang.org/en/master/command_injection_rdoc.html#label-Command+Injection].
#
# If the first argument is a hash, it becomes leading argument +env+
# in each call to Process.spawn;
Expand All @@ -977,6 +1009,8 @@ def capture2e(*cmd)
# - An array containing a +command_line+ or an +exe_path+,
# along with zero or more string arguments for the command.
#
# See {Argument command_line or exe_path}[https://docs.ruby-lang.org/en/master/Process.html#module-Process-label-Argument+command_line+or+exe_path].
#
def pipeline_rw(*cmds, &block)
if Hash === cmds.last
opts = cmds.pop.dup
Expand Down Expand Up @@ -1047,7 +1081,7 @@ def pipeline_rw(*cmds, &block)
#
# Like Process.spawn, this method has potential security vulnerabilities
# if called with untrusted input;
# see {Command Injection}[rdoc-ref:command_injection.rdoc].
# see {Command Injection}[https://docs.ruby-lang.org/en/master/command_injection_rdoc.html#label-Command+Injection].
#
# If the first argument is a hash, it becomes leading argument +env+
# in each call to Process.spawn;
Expand All @@ -1065,6 +1099,8 @@ def pipeline_rw(*cmds, &block)
# - An array containing a +command_line+ or an +exe_path+,
# along with zero or more string arguments for the command.
#
# See {Argument command_line or exe_path}[https://docs.ruby-lang.org/en/master/Process.html#module-Process-label-Argument+command_line+or+exe_path].
#
def pipeline_r(*cmds, &block)
if Hash === cmds.last
opts = cmds.pop.dup
Expand Down Expand Up @@ -1136,7 +1172,7 @@ def pipeline_r(*cmds, &block)
#
# Like Process.spawn, this method has potential security vulnerabilities
# if called with untrusted input;
# see {Command Injection}[rdoc-ref:command_injection.rdoc].
# see {Command Injection}[https://docs.ruby-lang.org/en/master/command_injection_rdoc.html#label-Command+Injection].
#
# If the first argument is a hash, it becomes leading argument +env+
# in each call to Process.spawn;
Expand All @@ -1154,6 +1190,8 @@ def pipeline_r(*cmds, &block)
# - An array containing a +command_line+ or an +exe_path+,
# along with zero or more string arguments for the command.
#
# See {Argument command_line or exe_path}[https://docs.ruby-lang.org/en/master/Process.html#module-Process-label-Argument+command_line+or+exe_path].
#
def pipeline_w(*cmds, &block)
if Hash === cmds.last
opts = cmds.pop.dup
Expand Down Expand Up @@ -1211,7 +1249,7 @@ def pipeline_w(*cmds, &block)
#
# Like Process.spawn, this method has potential security vulnerabilities
# if called with untrusted input;
# see {Command Injection}[rdoc-ref:command_injection.rdoc].
# see {Command Injection}[https://docs.ruby-lang.org/en/master/command_injection_rdoc.html#label-Command+Injection].
#
# If the first argument is a hash, it becomes leading argument +env+
# in each call to Process.spawn;
Expand All @@ -1229,6 +1267,8 @@ def pipeline_w(*cmds, &block)
# - An array containing a +command_line+ or an +exe_path+,
# along with zero or more string arguments for the command.
#
# See {Argument command_line or exe_path}[https://docs.ruby-lang.org/en/master/Process.html#module-Process-label-Argument+command_line+or+exe_path].
#
def pipeline_start(*cmds, &block)
if Hash === cmds.last
opts = cmds.pop.dup
Expand Down Expand Up @@ -1271,7 +1311,7 @@ def pipeline_start(*cmds, &block)
#
# Like Process.spawn, this method has potential security vulnerabilities
# if called with untrusted input;
# see {Command Injection}[rdoc-ref:command_injection.rdoc].
# see {Command Injection}[https://docs.ruby-lang.org/en/master/command_injection_rdoc.html#label-Command+Injection].
#
# If the first argument is a hash, it becomes leading argument +env+
# in each call to Process.spawn;
Expand All @@ -1289,6 +1329,8 @@ def pipeline_start(*cmds, &block)
# - An array containing a +command_line+ or an +exe_path+,
# along with zero or more string arguments for the command.
#
# See {Argument command_line or exe_path}[https://docs.ruby-lang.org/en/master/Process.html#module-Process-label-Argument+command_line+or+exe_path].
#
def pipeline(*cmds)
if Hash === cmds.last
opts = cmds.pop.dup
Expand Down