From f2bb5394596c96ce5d7ff415694f3fc83715a96b Mon Sep 17 00:00:00 2001 From: Hiroshi SHIBATA Date: Thu, 30 Nov 2023 12:20:19 +0900 Subject: Manually sync with https://github.com/ruby/open3/pull/22 and related PRs --- lib/open3.rb | 90 ++++++++++++++++++++++++++++++++++++++++++++---------------- 1 file changed, 66 insertions(+), 24 deletions(-) (limited to 'lib/open3.rb') diff --git a/lib/open3.rb b/lib/open3.rb index 9810174975..74d00b86d9 100644 --- a/lib/open3.rb +++ b/lib/open3.rb @@ -72,11 +72,11 @@ require 'open3/version' # Each of the methods above accepts: # # - An optional hash of environment variable names and values; -# see {Execution Environment}[rdoc-ref:Process#Execution+Environment]. +# see {Execution Environment}[rdoc-ref:Process@Execution+Environment]. # - A required string argument that is a +command_line+ or +exe_path+; -# see {Argument command_line or exe_path}[rdoc-ref:Process#Argument+command_line+or+exe_path]. +# see {Argument command_line or exe_path}[rdoc-ref:Process@Argument+command_line+or+exe_path]. # - An optional hash of execution options; -# see {Execution Options}[rdoc-ref:Process#Execution+Options]. +# see {Execution Options}[rdoc-ref:Process@Execution+Options]. # module Open3 @@ -135,12 +135,17 @@ 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}[rdoc-ref:command_injection.rdoc@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; + # If the first argument is a hash, it becomes leading argument +env+ + # in the call to Process.spawn; + # see {Execution Environment}[rdoc-ref:Process@Execution+Environment]. + # + # If the last argument is a hash, it becomes trailing argument +options+ + # in the call to Process.spawn; # see {Execution Options}[rdoc-ref:Process@Execution+Options]. # # The single required argument is one of the following: @@ -283,12 +288,17 @@ 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}[rdoc-ref:command_injection.rdoc@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; + # If the first argument is a hash, it becomes leading argument +env+ + # in the call to Process.spawn; + # see {Execution Environment}[rdoc-ref:Process@Execution+Environment]. + # + # If the last argument is a hash, it becomes trailing argument +options+ + # in the call to Process.spawn; # see {Execution Options}[rdoc-ref:Process@Execution+Options]. # # The single required argument is one of the following: @@ -422,12 +432,17 @@ 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}[rdoc-ref:command_injection.rdoc@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; + # If the first argument is a hash, it becomes leading argument +env+ + # in the call to Process.spawn; + # see {Execution Environment}[rdoc-ref:Process@Execution+Environment]. + # + # If the last argument is a hash, it becomes trailing argument +options+ + # in the call to Process.spawn; # see {Execution Options}[rdoc-ref:Process@Execution+Options]. # # The single required argument is one of the following: @@ -555,15 +570,20 @@ 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}[rdoc-ref:command_injection.rdoc@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; + # If the first argument is a hash, it becomes leading argument +env+ + # in the call to Open3.popen3; + # see {Execution Environment}[rdoc-ref:Process@Execution+Environment]. + # + # If the last argument is a hash, it becomes trailing argument +options+ + # in the call to Open3.popen3; # see {Execution Options}[rdoc-ref:Process@Execution+Options]. # - # The hash +options+ is passed to method Open3.popen3; + # The hash +options+ is given; # two options have local effect in method Open3.capture3: # # - If entry options[:stdin_data] exists, the entry is removed @@ -572,7 +592,7 @@ module Open3 # Open3.capture3('tee', stdin_data: 'Foo') # # => ["Foo", "", #] # - # - If entry options[:binmode] exists, the entry is removed + # - If entry options[:binmode] exists, the entry is removed and # the internal streams are set to binary mode. # # The single required argument is one of the following: @@ -676,15 +696,20 @@ 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}[rdoc-ref:command_injection.rdoc@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; + # If the first argument is a hash, it becomes leading argument +env+ + # in the call to Open3.popen3; + # see {Execution Environment}[rdoc-ref:Process@Execution+Environment]. + # + # If the last argument is a hash, it becomes trailing argument +options+ + # in the call to Open3.popen3; # see {Execution Options}[rdoc-ref:Process@Execution+Options]. # - # The hash +options+ is passed to method Open3.popen3; + # The hash +options+ is given; # two options have local effect in method Open3.capture2: # # - If entry options[:stdin_data] exists, the entry is removed @@ -694,6 +719,7 @@ module Open3 # # # => ["Foo", #] # + # - If entry options[:binmode] exists, the entry is removed and # the internal streams are set to binary mode. # # The single required argument is one of the following: @@ -798,15 +824,20 @@ 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}[rdoc-ref:command_injection.rdoc@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; + # If the first argument is a hash, it becomes leading argument +env+ + # in the call to Open3.popen3; + # see {Execution Environment}[rdoc-ref:Process@Execution+Environment]. + # + # If the last argument is a hash, it becomes trailing argument +options+ + # in the call to Open3.popen3; # see {Execution Options}[rdoc-ref:Process@Execution+Options]. # - # The hash +options+ is passed to method Open3.popen3; + # The hash +options+ is given; # two options have local effect in method Open3.capture2e: # # - If entry options[:stdin_data] exists, the entry is removed @@ -815,6 +846,7 @@ module Open3 # Open3.capture2e('tee', stdin_data: 'Foo') # # => ["Foo", #] # + # - If entry options[:binmode] exists, the entry is removed and # the internal streams are set to binary mode. # # The single required argument is one of the following: @@ -959,7 +991,7 @@ 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}[rdoc-ref:command_injection.rdoc@Command+Injection]. # # If the first argument is a hash, it becomes leading argument +env+ # in each call to Process.spawn; @@ -977,6 +1009,8 @@ module Open3 # - 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}[rdoc-ref:Process@Argument+command_line+or+exe_path]. + # def pipeline_rw(*cmds, &block) if Hash === cmds.last opts = cmds.pop.dup @@ -1047,7 +1081,7 @@ 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}[rdoc-ref:command_injection.rdoc@Command+Injection]. # # If the first argument is a hash, it becomes leading argument +env+ # in each call to Process.spawn; @@ -1065,6 +1099,8 @@ module Open3 # - 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}[rdoc-ref:Process@Argument+command_line+or+exe_path]. + # def pipeline_r(*cmds, &block) if Hash === cmds.last opts = cmds.pop.dup @@ -1136,7 +1172,7 @@ 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}[rdoc-ref:command_injection.rdoc@Command+Injection]. # # If the first argument is a hash, it becomes leading argument +env+ # in each call to Process.spawn; @@ -1154,6 +1190,8 @@ module Open3 # - 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}[rdoc-ref:Process@Argument+command_line+or+exe_path]. + # def pipeline_w(*cmds, &block) if Hash === cmds.last opts = cmds.pop.dup @@ -1211,7 +1249,7 @@ 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}[rdoc-ref:command_injection.rdoc@Command+Injection]. # # If the first argument is a hash, it becomes leading argument +env+ # in each call to Process.spawn; @@ -1229,6 +1267,8 @@ module Open3 # - 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}[rdoc-ref:Process@Argument+command_line+or+exe_path]. + # def pipeline_start(*cmds, &block) if Hash === cmds.last opts = cmds.pop.dup @@ -1271,7 +1311,7 @@ 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}[rdoc-ref:command_injection.rdoc@Command+Injection]. # # If the first argument is a hash, it becomes leading argument +env+ # in each call to Process.spawn; @@ -1289,6 +1329,8 @@ module Open3 # - 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}[rdoc-ref:Process@Argument+command_line+or+exe_path]. + # def pipeline(*cmds) if Hash === cmds.last opts = cmds.pop.dup -- cgit v1.2.3