ÿØÿà JFIF ÿÛ „ ( %!1!%)+//.383,7(-.+
-%%-////---/-.+/--+------/------/--0+--/-/-----.-----ÿÀ ¥2" ÿÄ ÿÄ J ! 1AQ"aq2‘#BR‚¡ÁÑ3br’¢±Âð$CSƒ²á4c“%DsÓñÿÄ ÿÄ * !1AQa‘"2q3±ð#b¡ÿÚ ? ¼QxJQaÍuò¸Zö Úü8,ÐÚú
"SSn<rçù–´âE—^ªBÖ9À\†¸ÔÁTÃÛ5
ëd´³Í#Ý;Þ38œî ¶H£M:wÎ3…³…âpÔF&‚FK¸9„â4àGEõªfÿ ‘ñ(ßwpŽF|È¥ù®häðÍѶ¹‘[ÒinÙW¶ùñY˜Q{›K"išÒ[Ú8žë\F¹@-?v"ÔU”,ìöžkÿ {I‡£šÍ?e
ríV
?>
.........................................
.............................................................................
ÿØÿà JFIF ÿÛ „
(
%!1!%)+//.383,7(-.+
-%%-////---/-.+/--+------/------/--0+--/-/-----.-----ÿÀ ¥2" ÿÄ
ÿÄ J ! 1AQ"aq2‘#BR‚¡ÁÑ3br’¢±Âð$CSƒ²á4c“%DsÓñÿÄ
ÿÄ * !1AQa‘"2q3±ð#b¡ÿÚ
? ¼QxJQaÍuò¸Zö
Úü8,ÐÚú
"SSn<rçù–´âE—^ªBÖ9À\†¸ÔÁTÃÛ5
ëd´³Í#Ý;Þ38œî ¶H£M:wÎ3…³…âpÔF&‚FK¸9„â4àGEõªfÿ ‘ñ(ßwpŽF|È¥ù®häðÍѶ¹‘[ÒinÙW¶ùñY˜Q{›K"išÒ[Ú8žë\F¹@-?v"ÔU”,ìöžkÿ {I‡£šÍ?e
ríV
?>
.........................................
.............................................................................
????????????????????????????????????
????????????????????????????????????
ÿØÿà JFIF ÿÛ „ ( %!1!%)+//.383,7(-.+
-%%-////---/-.+/--+------/------/--0+--/-/-----.-----ÿÀ ¥2" ÿÄ ÿÄ J ! 1AQ"aq2‘#BR‚¡ÁÑ3br’¢±Âð$CSƒ²á4c“%DsÓñÿÄ ÿÄ * !1AQa‘"2q3±ð#b¡ÿÚ ? ¼QxJQaÍuò¸Zö Úü8,ÐÚú
"SSn<rçù–´âE—^ªBÖ9À\†¸ÔÁTÃÛ5
ëd´³Í#Ý;Þ38œî ¶H£M:wÎ3…³…âpÔF&‚FK¸9„â4àGEõªfÿ ‘ñ(ßwpŽF|È¥ù®häðÍѶ¹‘[ÒinÙW¶ùñY˜Q{›K"išÒ[Ú8žë\F¹@-?v"ÔU”,ìöžkÿ {I‡£šÍ?e
ríV
?>
.........................................
.............................................................................
ÿØÿà JFIF ÿÛ „
(
%!1!%)+//.383,7(-.+
-%%-////---/-.+/--+------/------/--0+--/-/-----.-----ÿÀ ¥2" ÿÄ
ÿÄ J ! 1AQ"aq2‘#BR‚¡ÁÑ3br’¢±Âð$CSƒ²á4c“%DsÓñÿÄ
ÿÄ * !1AQa‘"2q3±ð#b¡ÿÚ
? ¼QxJQaÍuò¸Zö
Úü8,ÐÚú
"SSn<rçù–´âE—^ªBÖ9À\†¸ÔÁTÃÛ5
ëd´³Í#Ý;Þ38œî ¶H£M:wÎ3…³…âpÔF&‚FK¸9„â4àGEõªfÿ ‘ñ(ßwpŽF|È¥ù®häðÍѶ¹‘[ÒinÙW¶ùñY˜Q{›K"išÒ[Ú8žë\F¹@-?v"ÔU”,ìöžkÿ {I‡£šÍ?e
ríV
?>
.........................................
.............................................................................
????????????????????????????????????
????????????????????????????????????
U:RDoc::AnyMethod[iI"popen2e:ETI"Open3::popen2e;TT:publico:RDoc::Markup::Document:@parts[8o:RDoc::Markup::Paragraph; [I"Basically a wrapper for ;TI"-{Process.spawn}[rdoc-ref:Process.spawn] ;TI"
that:;To:RDoc::Markup::BlankLine o:RDoc::Markup::List:
@type:BULLET:@items[o:RDoc::Markup::ListItem:@label0; [o;
; [I"PCreates a child process, by calling Process.spawn with the given arguments.;To;;0; [o;
; [I"3Creates streams +stdin+, +stdout_and_stderr+, ;TI"Gwhich are the standard input and the merge of the standard output ;TI"5and standard error streams in the child process.;To;;0; [o;
; [I"LCreates thread +wait_thread+ that waits for the child process to exit; ;TI"?the thread has method +pid+, which returns the process ID ;TI"of the child process.;T@o;
; [I",With no block given, returns the array ;TI"7[stdin, stdout_and_stderr, wait_thread]. ;TI">The caller should close each of the two returned streams.;T@o:RDoc::Markup::Verbatim; [I"Cstdin, stdout_and_stderr, wait_thread = Open3.popen2e('echo')
;TI"N# => [#, #, #]
;TI"stdin.close
;TI"stdout_and_stderr.close
;TI"$wait_thread.pid # => 2274600
;TI"Cwait_thread.value # => #
;T:@format0o;
; [ I"BWith a block given, calls the block with the three variables ;TI"'(two streams and the wait thread) ;TI"+and returns the block's return value. ;TI"+The caller need not close the streams:;T@o;; [I"FOpen3.popen2e('echo') do |stdin, stdout_and_stderr, wait_thread|
;TI" p stdin
;TI" p stdout_and_stderr
;TI" p wait_thread
;TI" p wait_thread.pid
;TI" p wait_thread.value
;TI" end
;T;0o;
; [I"Output:;T@o;; [
I"#
;TI"#
;TI"1#
;TI"
2274763
;TI",#
;T;0o;
; [I"LLike Process.spawn, this method has potential security vulnerabilities ;TI"%if called with untrusted input; ;TI"Psee {Command Injection}[rdoc-ref:command_injection.rdoc@Command+Injection].;T@o;
; [I"KUnlike Process.spawn, this method waits for the child process to exit ;TI"4before returning, so the caller need not do so.;T@o;
; [I"HIf the first argument is a hash, it becomes leading argument +env+ ;TI"#in the call to Process.spawn; ;TI"Isee {Execution Environment}[rdoc-ref:Process@Execution+Environment].;T@o;
; [I"LIf the last argument is a hash, it becomes trailing argument +options+ ;TI"#in the call to Process.spawn; ;TI"Asee {Execution Options}[rdoc-ref:Process@Execution+Options].;T@o;
; [I":The single required argument is one of the following:;T@o;;
;;[o;;0; [o;
; [I"'+command_line+ if it is a string, ;TI"Fand if it begins with a shell reserved word or special built-in, ;TI"2or if it contains one or more metacharacters.;To;;0; [o;
; [I"+exe_path+ otherwise.;T@o;
; [I"#Argument +command_line+;T@o;
; [I"P\String argument +command_line+ is a command line to be passed to a shell; ;TI"Nit must begin with a shell reserved word, begin with a special built-in, ;TI" or contain meta characters:;T@o;; [I"\Open3.popen2e('if true; then echo "Foo"; fi') {|*args| p args } # Shell reserved word.
;TI"QOpen3.popen2e('echo') {|*args| p args } # Built-in.
;TI"`Open3.popen2e('date > date.tmp') {|*args| p args } # Contains meta character.
;T;0o;
; [I"*Output (similar for each call above):;T@o;; [I"W# => [#, #, #]
;T;0o;
; [I"MThe command line may also contain arguments and options for the command:;T@o;; [I"BOpen3.popen2e('echo "Foo"') { |i, o_and_e, t| o_and_e.gets }
;TI"
"Foo\n"
;T;0o;
; [I"Argument +exe_path+;T@o;
; [I"1Argument +exe_path+ is one of the following:;T@o;;
;;[o;;0; [o;
; [I"3The string path to an executable to be called.;To;;0; [o;
; [I" "Thu Sep 28 01:58:45 PM CDT 2023\n"
;T;0o;
; [I"PRuby invokes the executable directly, with no shell and no shell expansion:;T@o;; [I"[Open3.popen2e('doesnt_exist') { |i, o_and_e, t| o_and_e.gets } # Raises Errno::ENOENT
;T;0o;
; [I"CIf one or more +args+ is given, each is an argument or option ;TI"$to be passed to the executable:;T@o;; [ I"COpen3.popen2e('echo', 'C #') { |i, o_and_e, t| o_and_e.gets }
;TI"# => "C #\n"
;TI"NOpen3.popen2e('echo', 'hello', 'world') { |i, o_and_e, t| o_and_e.gets }
;TI"# => "hello world\n"
;T;0o;
; [I"
Related:;T@o;;
;;[o;;0; [o;
; [I"HOpen3.popen2: Makes the standard input and standard output streams ;TI"9of the child process available as separate streams, ;TI"1with no access to the standard error stream.;To;;0; [o;
; [I">Open3.popen3: Makes the standard input, standard output, ;TI" and standard error streams ;TI"8of the child process available as separate streams.;T:
@fileI"lib/open3.rb;T:0@omit_headings_from_table_of_contents_below0I"Open3.popen2e([env, ] command_line, options = {}) -> [stdin, stdout_and_stderr, wait_thread]
Open3.popen2e([env, ] exe_path, *args, options = {}) -> [stdin, stdout_and_stderr, wait_thread]
Open3.popen2e([env, ] command_line, options = {}) {|stdin, stdout_and_stderr, wait_thread| ... } -> object
Open3.popen2e([env, ] exe_path, *args, options = {}) {|stdin, stdout_and_stderr, wait_thread| ... } -> object
;T0[ I"(*cmd, &block);T@FI"
Open3;TcRDoc::NormalModule00