childprocess 0.1.2 → 0.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.2
1
+ 0.1.3
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{childprocess}
8
- s.version = "0.1.2"
8
+ s.version = "0.1.3"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Jari Bakken"]
@@ -45,11 +45,13 @@ Gem::Specification.new do |s|
45
45
  "lib/childprocess/windows/io.rb",
46
46
  "lib/childprocess/windows/process.rb",
47
47
  "lib/childprocess/windows/structs.rb",
48
+ "spec/abstract_io_spec.rb",
48
49
  "spec/childprocess_spec.rb",
49
50
  "spec/jruby_spec.rb",
50
51
  "spec/spec.opts",
51
52
  "spec/spec_helper.rb",
52
- "spec/unix_spec.rb"
53
+ "spec/unix_spec.rb",
54
+ "spec/windows_spec.rb"
53
55
  ]
54
56
  s.homepage = %q{http://github.com/jarib/childprocess}
55
57
  s.rdoc_options = ["--charset=UTF-8"]
@@ -61,7 +63,8 @@ Gem::Specification.new do |s|
61
63
  "spec/childprocess_spec.rb",
62
64
  "spec/jruby_spec.rb",
63
65
  "spec/spec_helper.rb",
64
- "spec/unix_spec.rb"
66
+ "spec/unix_spec.rb",
67
+ "spec/windows_spec.rb"
65
68
  ]
66
69
 
67
70
  if s.respond_to? :specification_version then
@@ -44,6 +44,10 @@ module ChildProcess
44
44
  platform == :jruby
45
45
  end
46
46
 
47
+ def windows?
48
+ !jruby? && os == :windows
49
+ end
50
+
47
51
  def os
48
52
  @os ||= (
49
53
  require "rbconfig"
@@ -14,7 +14,7 @@ module ChildProcess
14
14
  io.respond_to?(:fileno) && io.fileno
15
15
  end
16
16
 
17
- def has_to_io?
17
+ def has_to_io?(io)
18
18
  io.respond_to?(:to_io) && io.to_io.kind_of?(::IO)
19
19
  end
20
20
 
@@ -47,7 +47,8 @@ module ChildProcess
47
47
  opts[:stderr] = @io.stderr
48
48
  end
49
49
 
50
- command = @args.map { |e| e.inspect }.join(' ')
50
+ # TODO: escape/quote arguments properly
51
+ command = @args.join ' '
51
52
 
52
53
  @pid = Lib.create_proc(command, opts)
53
54
  @handle = Handle.open(@pid)
@@ -2,10 +2,10 @@ require File.expand_path('../spec_helper', __FILE__)
2
2
 
3
3
  describe ChildProcess::AbstractIO do
4
4
  let(:io) { ChildProcess::AbstractIO.new }
5
-
5
+
6
6
  it "inherits the parent's IO streams" do
7
7
  io.inherit!
8
-
8
+
9
9
  io.stdout.should == STDOUT
10
10
  io.stderr.should == STDERR
11
11
  end
@@ -38,7 +38,7 @@ if ChildProcess.unix?
38
38
  lambda { io.stdout = nil }.should raise_error(ArgumentError, /to respond to :to_io/)
39
39
  end
40
40
 
41
- it "raises an ArgumentError if the IO's fileno is nil" do
41
+ it "raises a TypeError if #to_io does not return an IO" do
42
42
  fake_io = Object.new
43
43
  def fake_io.to_io() StringIO.new end
44
44
 
@@ -0,0 +1,18 @@
1
+ require File.expand_path('../spec_helper', __FILE__)
2
+
3
+ if ChildProcess.windows?
4
+ describe ChildProcess::Windows::IO do
5
+ let(:io) { ChildProcess::Windows::IO.new }
6
+
7
+ it "raises an ArgumentError if given IO does not respond to :fileno" do
8
+ lambda { io.stdout = nil }.should raise_error(ArgumentError, /must have :fileno or :to_io/)
9
+ end
10
+
11
+ it "raises an ArgumentError if the #to_io does not return an IO " do
12
+ fake_io = Object.new
13
+ def fake_io.to_io() StringIO.new end
14
+
15
+ lambda { io.stdout = fake_io }.should raise_error(ArgumentError, /must have :fileno or :to_io/)
16
+ end
17
+ end
18
+ end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 1
8
- - 2
9
- version: 0.1.2
8
+ - 3
9
+ version: 0.1.3
10
10
  platform: ruby
11
11
  authors:
12
12
  - Jari Bakken
@@ -98,12 +98,13 @@ files:
98
98
  - lib/childprocess/windows/io.rb
99
99
  - lib/childprocess/windows/process.rb
100
100
  - lib/childprocess/windows/structs.rb
101
+ - spec/abstract_io_spec.rb
101
102
  - spec/childprocess_spec.rb
102
103
  - spec/jruby_spec.rb
103
104
  - spec/spec.opts
104
105
  - spec/spec_helper.rb
105
106
  - spec/unix_spec.rb
106
- - spec/abstract_io_spec.rb
107
+ - spec/windows_spec.rb
107
108
  has_rdoc: true
108
109
  homepage: http://github.com/jarib/childprocess
109
110
  licenses: []
@@ -142,3 +143,4 @@ test_files:
142
143
  - spec/jruby_spec.rb
143
144
  - spec/spec_helper.rb
144
145
  - spec/unix_spec.rb
146
+ - spec/windows_spec.rb