aboutsummaryrefslogtreecommitdiffstats
path: root/lib/open3.rb
Commit message (Collapse)AuthorAgeFilesLines
* [ruby/open3] Update to match JRuby 9.4Charles Oliver Nutter2021-12-091-5/+4
| | | | | | | | | | | | | | | | | | | | This allows the wrapper functions in the main open3 to be defined while using our ProcessBuilder logic for the internal popen implementation. Note this adds logic to reject redirects from a numeric fd to a live IO object (or not a String or to_path object) since we cannot support direct IO redirects with ProcesBuilder. This patch allows tests to complete with the ProcessBuilder impl. Only three tests fail: * test_numeric_file_descriptor2 and test_numeric_file_descriptor2 fail due to redirecting streams to a pipe IO. * test_pid fails expecting a real PID which we cannot provide via ProcessBuilder. https://github.com/ruby/open3/commit/73f986c233
* [ruby/open3] Add JRuby's Windows (JDK non-native) Open3 supportCharles Oliver Nutter2021-12-091-2/+7
| | | | | | | | | | | | | This adds JRuby's logic used on platforms where we do not have native access to posix_spawn and related posix functions needed to do fully-native subprocess launching and management. The code here instead uses the JDK ProcessBuilder logic to simulate most of the Open3 functionality. This code does not pass all tests, currently, but provides most of the key functionality on pure-Java (i.e. no native FFI) platforms. https://github.com/ruby/open3/commit/689da19c42
* Update library versions of the default gems.Hiroshi SHIBATA2020-12-221-1/+1
| | | | | They are followed up with https://github.com/ruby/ruby/commit/8fb02b7a97317090e3946e6f2d4a7d034f9699f1
* Extract version number from the sourceNobuyoshi Nakada2020-07-301-0/+1
| | | | | | | | | | | "requiring version.rb" strategy has some issues. - cannot work when cross-compiling - often introduces wrong namespace - must know the superclasses - costs at each runtime than at build-time etc.
* [open3] only close streams if a block is passedJean Boussier2020-06-181-4/+6
| | | | | | | | | | | | Ref: 5429deb075beb9a2b67adae269bbac16325876d1 The previous change totally borke `popen2e` in this usage: ```ruby require 'open3' stdin, stdout, process = Open3.popen2e("cat") puts stdout.read ```
* lib/open3.rb: make sure that pipes are closedYusuke Endoh2020-05-271-0/+5
| | | | | | | | | | | | Attempting to invoke a non-existent command led to the leak of fds. http://rubyci.s3.amazonaws.com/graviton2/ruby-master/log/20200526T140004Z.log.html.gz ``` [ 9101/20195] TestGemExtCmakeBuilder#test_self_build = 0.01 sLeaked file descriptor: TestGemExtCmakeBuilder#test_self_build: 7 : #<IO:fd 7> Leaked file descriptor: TestGemExtCmakeBuilder#test_self_build: 10 : #<IO:fd 10> Leaked file descriptor: TestGemExtCmakeBuilder#test_self_build: 11 : #<IO:fd 11> Leaked file descriptor: TestGemExtCmakeBuilder#test_self_build: 12 : #<IO:fd 12> ```
* open3.rb don't use keyword splat (**).akr2018-12-121-15/+86
| | | | | | | | | | | | | | | | | revert r43582, r49173 and r49177. open3 arguments uses spawn-like keyword arguments. Both symbol and integer keys are used. ``` Open3.capture2(*command, :in => IO::NULL, 3 => IO::NULL) `` This style cannot be supported with keyword splat (**) since Ruby 2.6. Because Ruby 2.6 prohibits symbol/non-symbol key hash separation. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66352 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Use `&.` instead of modifier ifkazu2018-04-301-2/+2
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63306 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* lib/open3.rb: accept IO-like object for :stdin_data argument.akr2017-10-211-3/+15
| | | | | | | | | | Open3.capture3, Open3.capture2, Open3.capture2e accepts IO-like object for :stdin_data argument. [ruby-core:80936] [Feature #13527] proposed by janko. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60236 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* lib/open3: favor symbol proc when possiblenormal2016-11-211-6/+6
| | | | | | | | | It reduces both human and machine code; as well as reducing the confusion from variable naming. * lib/open3.rb (popen_run, pipeline, pipeline_run): avoid capture git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56866 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* lib/*: remove closed checksnormal2016-11-211-2/+2
| | | | | | | | | | | | | | | | | | | | Follow r56795. Since Ruby 2.2, calling #close on a closed socket no longer raises exceptions. * lib/cgi/session.rb (update): remove closed? check * lib/net/http.rb (finish, transport_request): ditto * lib/net/imap.rb (disconnect): ditto * lib/net/pop.rb (do_start, do_finish): ditto * lib/net/smtp.rb (do_start, do_finish): ditto * lib/open3.rb (popen_run, pipeline_run): ditto * lib/pstore.rb (transaction): ditto * lib/shell/process-controller.rb (sfork): * lib/tempfile (_close, call, Tempfile.create): ditto * lib/webrick/httpauth/htdigest.rb (flush): ditto * lib/webrick/httpauth/htpasswd.rb (flush): ditto * lib/webrick/server.rb (start_thread, cleanup_shutdown_pipe): ditto git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56865 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * lib/open3.rb: Specify frozen_string_literal: true.akr2015-11-141-0/+2
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52568 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* open3.rb: Hash.try_convertnobu2015-01-081-1/+4
| | | | | | * lib/open3.rb (popen_run): use Hash.try_convert for duck typing. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49177 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * lib/open3.rb: Open3 properly passes non-keyword hash args to spawn.akr2015-01-071-0/+1
| | | | | | | | | Fixed by Josh Cheek. [Fix GH-808] Related to [ruby-core:67347] [Bug #10699] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49173 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * lib/open3.rb: fix code formatting in documentation by @JoshCheekhsbt2014-11-041-9/+9
| | | | | | [fix GH-747][ci skip] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48257 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * lib/cgi/session/pstore.rb: separated sample code.hsbt2014-08-101-13/+0
| | | | | | * lib/open3.rb: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47122 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * lib/open3.rb: avoid unnecessary write if stdin_data is empty.glass2014-08-071-8/+12
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47097 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * lib/open3.rb (Open3.capture3): Ignore Errno::EPIPE for writingakr2014-03-011-3/+12
| | | | | | | | | | stdin_data. (Open3.capture2): Ditto. (Open3.capture2e): Ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45229 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * lib/open3.rb: [DOC] Fix typo (s/thumnail/thumbnail/)a_matsuda2013-12-011-3/+3
| | | | | | [ci skip] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43941 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * lib/open3.rb: receive arguments as keyword arguments.glass2013-11-081-86/+11
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43582 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* lib/open3.rb: tweaked grammar in commentsduerst2013-11-061-45/+45
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43554 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * lib/open3.rb : Typo in Open3 overview. Patch by zed_0xffzzak2013-01-131-1/+1
| | | | | | | [Github Fixes #233] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38795 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* update doc.akr2011-12-171-5/+5
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34059 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * ext/pathname/lib/pathname.rb, ext/tk/lib/multi-tk.rb,ktsj2011-11-051-4/+4
| | | | | | | | | | | | | ext/tk/sample/demos-en/widget, lib/benchmark.rb, lib/irb/cmd/fork.rb, lib/mkmf.rb, lib/net/ftp.rb, lib/net/smtp.rb, lib/open3.rb, lib/pstore.rb, lib/rexml/element.rb, lib/rexml/light/node.rb, lib/rinda/tuplespace.rb, lib/rss/maker/base.rb, lib/rss/maker/entry.rb, lib/scanf.rb, lib/set.rb, lib/shell.rb, lib/shell/command-processor.rb, lib/shell/process-controller.rb, lib/shell/system-command.rb, lib/uri/common.rb: remove unused block arguments to avoid creating Proc objects. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33638 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* update doc.akr2011-10-241-1/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33518 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* update doc.akr2011-08-031-0/+9
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32827 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * lib: Convert tabs to spaces for ruby files perdrbrain2011-05-181-4/+4
| | | | | | | | | http://redmine.ruby-lang.org/projects/ruby/wiki/DeveloperHowto#coding-style Patch by Steve Klabnik [Ruby 1.9 - Bug #4730] Patch by Jason Dew [Ruby 1.9 - Feature #4718] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31635 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* fix doc again.akr2010-07-021-3/+3
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28529 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* fix doc.akr2010-07-021-3/+3
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28528 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* update rdoc.akr2010-02-281-6/+6
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26777 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * lib/open3.rb (Open3.pipeline_start): return an array of threads if aakr2008-12-101-20/+98
| | | | | | | block is not given. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20618 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* rdoc update.akr2008-12-081-2/+16
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20586 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* rdoc update.akr2008-12-071-0/+2
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20571 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* rdoc update.akr2008-12-071-0/+11
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20570 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * lib/open3.rb (Open3.capture3): renamed from Open3.poutput3.akr2008-12-071-23/+23
| | | | | | | | (Open3.capture2): renamed from Open3.poutput2. (lOpen3.capture2e): renamed from Open3.poutput2e. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20569 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * lib/open3.rb (Open3.poutput3): :binmode option implemented.akr2008-12-071-6/+62
| | | | | | | | (Open3.poutput2): ditto. (Open3.poutput2e): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20567 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* update rdoc.akr2008-12-061-14/+24
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20566 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * lib/open3.rb (Open3.pipeline_start): new method.akr2008-12-051-28/+126
| | | | | | | (Open3.pipeline): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20544 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* update rdoc.akr2008-12-041-17/+14
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20533 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* rdoc update.akr2008-12-041-0/+7
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20518 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * lib/open3.rb (Open3.poutput3): new method.akr2008-12-041-10/+89
| | | | | | | | | (Open3.poutput2): ditto. (Open3.poutput2e): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20516 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * lib/open3.rb (Open3.popen3): simplified.akr2008-12-041-54/+263
| | | | | | | | | | | | | | (Open3.popen_run): extracted from Open3.popen3. (Open3.popen2): new method. (Open3.popen2e): new method. (Open3.pipeline_rw): new method. (Open3.pipeline_r): new method. (Open3.pipeline_w): new method. (Open3.pipeline_run): new private method. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20512 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * lib/open3.rb (Open3.popen3): merge hash options if given. akr2008-12-021-19/+89
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20448 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * process.c (rb_detach_process): store detached process ID in thenobu2008-06-201-1/+0
| | | | | | | thread local storage. moved from lib/open3.rb. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17469 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * lib/open3.rb (Open3.popen3w): removed.akr2008-04-261-42/+15
| | | | | | | (Open3.popen3): notice wait_thr. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16213 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* describe about waiting a child process.akr2008-04-261-2/+5
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16209 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* describe :pid thread variable.akr2008-04-261-0/+3
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16208 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * lib/open3.rb: double fork is replaced by spawn with Process.detach.akr2008-04-261-29/+48
| | | | | | | | (Open3.popen3w): new method to access the thread returned by Process.detach. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16198 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * lib/parsedate.rb: documentation patch from Konrad Meyermatz2006-10-091-13/+32
| | | | | | | | | <konrad.meyer@gmail.com>. [ruby-doc:1238] * lib/open3.rb, lib/ping.rb: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11113 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Documentation cleanup.drbrain2006-08-041-10/+15
| | | | | | | | | | Includes patches by Hugh Sasse: * ping.rb * weakref.rb * mailread.rb git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@10668 b2dd03c8-39d4-4d8f-98ff-823fe69b080e