[DRE-commits] [ruby-childprocess] 01/05: Imported Upstream version 0.5.8

Antonio Terceiro terceiro at moszumanska.debian.org
Tue Dec 15 13:30:42 UTC 2015


This is an automated email from the git hooks/post-receive script.

terceiro pushed a commit to branch master
in repository ruby-childprocess.

commit d9703095c36dec60399df90612f156a790fa6858
Author: Antonio Terceiro <terceiro at debian.org>
Date:   Tue Dec 15 10:34:23 2015 -0200

    Imported Upstream version 0.5.8
---
 .travis.yml                                  |  2 ++
 LICENSE                                      |  2 +-
 README.md                                    |  6 +++-
 lib/childprocess/unix/posix_spawn_process.rb | 10 +++----
 lib/childprocess/unix/process.rb             |  3 ++
 lib/childprocess/version.rb                  |  2 +-
 lib/childprocess/windows/process.rb          |  3 +-
 metadata.yml                                 | 43 ++++++++++++++--------------
 spec/childprocess_spec.rb                    | 12 ++++++++
 spec/io_spec.rb                              | 12 +++++++-
 10 files changed, 63 insertions(+), 32 deletions(-)

diff --git a/.travis.yml b/.travis.yml
index 1d44321..c3cc7d7 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -5,6 +5,8 @@ rvm:
   - 2.0.0
   - 2.1.0
   - ruby-head
+sudo: false
+cache: bundler
 env:
   - CHILDPROCESS_POSIX_SPAWN=true CHILDPROCESS_UNSET=should-be-unset
   - CHILDPROCESS_POSIX_SPAWN=false CHILDPROCESS_UNSET=should-be-unset
diff --git a/LICENSE b/LICENSE
index f1007a9..50cfbae 100644
--- a/LICENSE
+++ b/LICENSE
@@ -1,4 +1,4 @@
-Copyright (c) 2010-2014 Jari Bakken
+Copyright (c) 2010-2015 Jari Bakken
 
 Permission is hereby granted, free of charge, to any person obtaining
 a copy of this software and associated documentation files (the
diff --git a/README.md b/README.md
index f9383f0..6efa1c4 100644
--- a/README.md
+++ b/README.md
@@ -153,6 +153,10 @@ ChildProcess.build("cmd.exe", "/c", "bundle")
 ChildProcess.build("ruby", "-S", "bundle")
 ```
 
+## Caveats
+
+* With JRuby on Unix, modifying `ENV["PATH"]` before using childprocess could lead to 'Command not found' errors, since JRuby is unable to modify the environemnt used for PATH searches in `java.lang.ProcessBuilder`. This can be avoided by setting `ChildProcess.posix_spawn = true`.
+
 # Implementation
 
 How the process is launched and killed depends on the platform:
@@ -171,4 +175,4 @@ How the process is launched and killed depends on the platform:
 
 # Copyright
 
-Copyright (c) 2010-2014 Jari Bakken. See LICENSE for details.
+Copyright (c) 2010-2015 Jari Bakken. See LICENSE for details.
diff --git a/lib/childprocess/unix/posix_spawn_process.rb b/lib/childprocess/unix/posix_spawn_process.rb
index 8cea199..31e7075 100644
--- a/lib/childprocess/unix/posix_spawn_process.rb
+++ b/lib/childprocess/unix/posix_spawn_process.rb
@@ -14,20 +14,20 @@ module ChildProcess
         attrs   = Lib::Attrs.new
 
         if io.stdout
-          actions.add_dup fileno_for(io.stdout), fileno_for($stdout)
+          actions.add_dup fileno_for(io.stdout), fileno_for(STDOUT)
         else
-          actions.add_open fileno_for($stdout), "/dev/null", File::WRONLY, 0644
+          actions.add_open fileno_for(STDOUT), "/dev/null", File::WRONLY, 0644
         end
 
         if io.stderr
-          actions.add_dup fileno_for(io.stderr), fileno_for($stderr)
+          actions.add_dup fileno_for(io.stderr), fileno_for(STDERR)
         else
-          actions.add_open fileno_for($stderr), "/dev/null", File::WRONLY, 0644
+          actions.add_open fileno_for(STDERR), "/dev/null", File::WRONLY, 0644
         end
 
         if duplex?
           reader, writer = ::IO.pipe
-          actions.add_dup fileno_for(reader), fileno_for($stdin)
+          actions.add_dup fileno_for(reader), fileno_for(STDIN)
           actions.add_close fileno_for(writer)
         end
 
diff --git a/lib/childprocess/unix/process.rb b/lib/childprocess/unix/process.rb
index 2c3ada2..bae5ecd 100644
--- a/lib/childprocess/unix/process.rb
+++ b/lib/childprocess/unix/process.rb
@@ -39,6 +39,9 @@ module ChildProcess
         end
 
         !!pid
+      rescue Errno::ECHILD
+        # may be thrown for detached processes
+        true
       end
 
       def wait
diff --git a/lib/childprocess/version.rb b/lib/childprocess/version.rb
index 648d252..0c503df 100644
--- a/lib/childprocess/version.rb
+++ b/lib/childprocess/version.rb
@@ -1,3 +1,3 @@
 module ChildProcess
-  VERSION = "0.5.5"
+  VERSION = "0.5.8"
 end
diff --git a/lib/childprocess/windows/process.rb b/lib/childprocess/windows/process.rb
index 3607cfa..149e2d7 100755
--- a/lib/childprocess/windows/process.rb
+++ b/lib/childprocess/windows/process.rb
@@ -45,7 +45,8 @@ module ChildProcess
 
         if exited
           @exit_code = code
-          @handle.close
+          close_handle
+          close_job_if_necessary
         end
 
         exited
diff --git a/metadata.yml b/metadata.yml
index 1c51980..e68ab8a 100644
--- a/metadata.yml
+++ b/metadata.yml
@@ -1,89 +1,89 @@
 --- !ruby/object:Gem::Specification
 name: childprocess
 version: !ruby/object:Gem::Version
-  version: 0.5.5
+  version: 0.5.8
 platform: ruby
 authors:
 - Jari Bakken
 autorequire: 
 bindir: bin
 cert_chain: []
-date: 2014-10-01 00:00:00.000000000 Z
+date: 2015-11-13 00:00:00.000000000 Z
 dependencies:
 - !ruby/object:Gem::Dependency
   name: rspec
   requirement: !ruby/object:Gem::Requirement
     requirements:
-    - - "~>"
+    - - ~>
       - !ruby/object:Gem::Version
         version: 3.0.0
   type: :development
   prerelease: false
   version_requirements: !ruby/object:Gem::Requirement
     requirements:
-    - - "~>"
+    - - ~>
       - !ruby/object:Gem::Version
         version: 3.0.0
 - !ruby/object:Gem::Dependency
   name: yard
   requirement: !ruby/object:Gem::Requirement
     requirements:
-    - - ">="
+    - - '>='
       - !ruby/object:Gem::Version
         version: '0'
   type: :development
   prerelease: false
   version_requirements: !ruby/object:Gem::Requirement
     requirements:
-    - - ">="
+    - - '>='
       - !ruby/object:Gem::Version
         version: '0'
 - !ruby/object:Gem::Dependency
   name: rake
   requirement: !ruby/object:Gem::Requirement
     requirements:
-    - - "~>"
+    - - ~>
       - !ruby/object:Gem::Version
         version: 0.9.2
   type: :development
   prerelease: false
   version_requirements: !ruby/object:Gem::Requirement
     requirements:
-    - - "~>"
+    - - ~>
       - !ruby/object:Gem::Version
         version: 0.9.2
 - !ruby/object:Gem::Dependency
   name: coveralls
   requirement: !ruby/object:Gem::Requirement
     requirements:
-    - - ">="
+    - - '>='
       - !ruby/object:Gem::Version
         version: '0'
   type: :development
   prerelease: false
   version_requirements: !ruby/object:Gem::Requirement
     requirements:
-    - - ">="
+    - - '>='
       - !ruby/object:Gem::Version
         version: '0'
 - !ruby/object:Gem::Dependency
   name: ffi
   requirement: !ruby/object:Gem::Requirement
     requirements:
-    - - "~>"
+    - - ~>
       - !ruby/object:Gem::Version
         version: '1.0'
-    - - ">="
+    - - '>='
       - !ruby/object:Gem::Version
         version: 1.0.11
   type: :runtime
   prerelease: false
   version_requirements: !ruby/object:Gem::Requirement
     requirements:
-    - - "~>"
+    - - ~>
       - !ruby/object:Gem::Version
         version: '1.0'
-    - - ">="
+    - - '>='
       - !ruby/object:Gem::Version
         version: 1.0.11
 description: This gem aims at being a simple and reliable solution for controlling
@@ -94,10 +94,10 @@ executables: []
 extensions: []
 extra_rdoc_files: []
 files:
-- ".document"
-- ".gitignore"
-- ".rspec"
-- ".travis.yml"
+- .document
+- .gitignore
+- .rspec
+- .travis.yml
 - Gemfile
 - LICENSE
 - README.md
@@ -148,17 +148,17 @@ require_paths:
 - lib
 required_ruby_version: !ruby/object:Gem::Requirement
   requirements:
-  - - ">="
+  - - '>='
     - !ruby/object:Gem::Version
       version: '0'
 required_rubygems_version: !ruby/object:Gem::Requirement
   requirements:
-  - - ">="
+  - - '>='
     - !ruby/object:Gem::Version
       version: '0'
 requirements: []
 rubyforge_project: childprocess
-rubygems_version: 2.2.0
+rubygems_version: 2.0.14
 signing_key: 
 specification_version: 4
 summary: This gem aims at being a simple and reliable solution for controlling external
@@ -172,4 +172,3 @@ test_files:
 - spec/spec_helper.rb
 - spec/unix_spec.rb
 - spec/windows_spec.rb
-has_rdoc: 
diff --git a/spec/childprocess_spec.rb b/spec/childprocess_spec.rb
index d0d0953..39f98b3 100644
--- a/spec/childprocess_spec.rb
+++ b/spec/childprocess_spec.rb
@@ -241,4 +241,16 @@ describe ChildProcess do
 
     threads.each { |t| t.join }
   end
+
+  it 'can check if a detached child is alive' do
+    proc = ruby_process("-e", "sleep")
+    proc.detach = true
+
+    proc.start
+
+    expect(proc).to be_alive
+    proc.stop(0)
+
+    expect(proc).to be_exited
+  end
 end
diff --git a/spec/io_spec.rb b/spec/io_spec.rb
index dddb274..5c1f505 100644
--- a/spec/io_spec.rb
+++ b/spec/io_spec.rb
@@ -1,7 +1,17 @@
 require File.expand_path('../spec_helper', __FILE__)
 
 describe ChildProcess do
- it "can redirect stdout, stderr" do
+  it "can run even when $stdout is a StringIO" do
+    begin
+      stdout = $stdout
+      $stdout = StringIO.new
+      expect { sleeping_ruby.start }.to_not raise_error
+    ensure
+      $stdout = stdout
+    end
+  end
+
+  it "can redirect stdout, stderr" do
     process = ruby(<<-CODE)
       [STDOUT, STDERR].each_with_index do |io, idx|
         io.sync = true

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-ruby-extras/ruby-childprocess.git



More information about the Pkg-ruby-extras-commits mailing list