subprocess 0.1.6 → 0.15
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +72 -0
- data/lib/subprocess.rb +529 -20
- metadata +55 -121
- data/History.txt +0 -4
- data/Manifest.txt +0 -46
- data/PostInstall.txt +0 -7
- data/README.rdoc +0 -77
- data/Rakefile +0 -20
- data/TODO.rdoc +0 -1
- data/examples/simple.irb +0 -22
- data/examples/simple_timeout.irb +0 -22
- data/features/multiple_popens_sequence.feature +0 -23
- data/features/popen.feature +0 -45
- data/features/popen_over_ssh.feature +0 -44
- data/features/popen_over_ssh_without_blocking.feature +0 -16
- data/features/popen_remote_fails_with_invalid_auth_data.feature +0 -13
- data/features/popen_reports_runtime.feature +0 -11
- data/features/popen_running.feature +0 -11
- data/features/popen_with_timeout.feature +0 -19
- data/features/popen_without_blocking.feature +0 -16
- data/features/step_definitions/common_steps.rb +0 -168
- data/features/step_definitions/multiple_popens_sequence_steps.rb +0 -73
- data/features/step_definitions/popen_over_ssh_steps.rb +0 -29
- data/features/step_definitions/popen_over_ssh_without_blocking_steps.rb +0 -30
- data/features/step_definitions/popen_remote_fails_with_invalid_auth_dat_steps.rb +0 -19
- data/features/step_definitions/popen_reports_runtime_steps.rb +0 -13
- data/features/step_definitions/popen_running_steps.rb +0 -12
- data/features/step_definitions/popen_steps.rb +0 -34
- data/features/step_definitions/popen_with_timeout_steps.rb +0 -24
- data/features/step_definitions/popen_without_blocking_steps.rb +0 -33
- data/features/support/common.rb +0 -29
- data/features/support/env.rb +0 -15
- data/features/support/matchers.rb +0 -11
- data/lib/core_ext/hash.rb +0 -14
- data/lib/core_ext/process_status.rb +0 -14
- data/lib/subprocess/popen.rb +0 -188
- data/lib/subprocess/popen_factory.rb +0 -63
- data/lib/subprocess/popen_remote.rb +0 -64
- data/lib/subprocess/popen_sequence.rb +0 -57
- data/script/console +0 -10
- data/script/destroy +0 -14
- data/script/generate +0 -14
- data/spec/spec.opts +0 -1
- data/spec/spec_helper.rb +0 -10
- data/spec/subprocess/popen_spec.rb +0 -32
- data/spec/subprocess_spec.rb +0 -2
- data/subprocess.gemspec +0 -36
- data/tasks/rspec.rake +0 -21
metadata
CHANGED
@@ -1,138 +1,72 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: subprocess
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
|
6
|
-
- 0
|
7
|
-
- 1
|
8
|
-
- 6
|
9
|
-
version: 0.1.6
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: '0.15'
|
5
|
+
prerelease:
|
10
6
|
platform: ruby
|
11
|
-
authors:
|
12
|
-
-
|
7
|
+
authors:
|
8
|
+
- Carl Jackson
|
9
|
+
- Evan Broder
|
10
|
+
- Nelson Elhage
|
11
|
+
- Andy Brody
|
12
|
+
- Andreas Fuchs
|
13
13
|
autorequire:
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
- !ruby/object:Gem::Version
|
27
|
-
segments:
|
28
|
-
- 2
|
29
|
-
- 0
|
30
|
-
- 4
|
31
|
-
version: 2.0.4
|
16
|
+
date: 2013-09-27 00:00:00.000000000 Z
|
17
|
+
dependencies:
|
18
|
+
- !ruby/object:Gem::Dependency
|
19
|
+
name: minitest
|
20
|
+
requirement: !ruby/object:Gem::Requirement
|
21
|
+
none: false
|
22
|
+
requirements:
|
23
|
+
- - ~>
|
24
|
+
- !ruby/object:Gem::Version
|
25
|
+
version: '5.0'
|
32
26
|
type: :development
|
33
|
-
version_requirements: *id001
|
34
|
-
- !ruby/object:Gem::Dependency
|
35
|
-
name: hoe
|
36
27
|
prerelease: false
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
- bram@craniumisajar.com
|
28
|
+
version_requirements: !ruby/object:Gem::Requirement
|
29
|
+
none: false
|
30
|
+
requirements:
|
31
|
+
- - ~>
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '5.0'
|
34
|
+
description: Control and communicate with spawned processes
|
35
|
+
email:
|
36
|
+
- carl@stripe.com
|
37
|
+
- evan@stripe.com
|
38
|
+
- nelhage@stripe.com
|
39
|
+
- andy@stripe.com
|
40
|
+
- asf@stripe.com
|
51
41
|
executables: []
|
52
|
-
|
53
42
|
extensions: []
|
54
|
-
|
55
|
-
|
56
|
-
- History.txt
|
57
|
-
- Manifest.txt
|
58
|
-
- PostInstall.txt
|
59
|
-
files:
|
60
|
-
- History.txt
|
61
|
-
- Manifest.txt
|
62
|
-
- PostInstall.txt
|
63
|
-
- README.rdoc
|
64
|
-
- Rakefile
|
65
|
-
- TODO.rdoc
|
66
|
-
- examples/simple.irb
|
67
|
-
- examples/simple_timeout.irb
|
68
|
-
- features/multiple_popens_sequence.feature
|
69
|
-
- features/popen.feature
|
70
|
-
- features/popen_over_ssh.feature
|
71
|
-
- features/popen_over_ssh_without_blocking.feature
|
72
|
-
- features/popen_remote_fails_with_invalid_auth_data.feature
|
73
|
-
- features/popen_reports_runtime.feature
|
74
|
-
- features/popen_running.feature
|
75
|
-
- features/popen_with_timeout.feature
|
76
|
-
- features/popen_without_blocking.feature
|
77
|
-
- features/step_definitions/common_steps.rb
|
78
|
-
- features/step_definitions/multiple_popens_sequence_steps.rb
|
79
|
-
- features/step_definitions/popen_over_ssh_steps.rb
|
80
|
-
- features/step_definitions/popen_over_ssh_without_blocking_steps.rb
|
81
|
-
- features/step_definitions/popen_remote_fails_with_invalid_auth_dat_steps.rb
|
82
|
-
- features/step_definitions/popen_reports_runtime_steps.rb
|
83
|
-
- features/step_definitions/popen_running_steps.rb
|
84
|
-
- features/step_definitions/popen_steps.rb
|
85
|
-
- features/step_definitions/popen_with_timeout_steps.rb
|
86
|
-
- features/step_definitions/popen_without_blocking_steps.rb
|
87
|
-
- features/support/common.rb
|
88
|
-
- features/support/env.rb
|
89
|
-
- features/support/matchers.rb
|
90
|
-
- lib/core_ext/hash.rb
|
91
|
-
- lib/core_ext/process_status.rb
|
43
|
+
extra_rdoc_files: []
|
44
|
+
files:
|
92
45
|
- lib/subprocess.rb
|
93
|
-
-
|
94
|
-
|
95
|
-
- lib/subprocess/popen_remote.rb
|
96
|
-
- lib/subprocess/popen_sequence.rb
|
97
|
-
- script/console
|
98
|
-
- script/destroy
|
99
|
-
- script/generate
|
100
|
-
- spec/spec.opts
|
101
|
-
- spec/spec_helper.rb
|
102
|
-
- spec/subprocess/popen_spec.rb
|
103
|
-
- spec/subprocess_spec.rb
|
104
|
-
- subprocess.gemspec
|
105
|
-
- tasks/rspec.rake
|
106
|
-
has_rdoc: true
|
107
|
-
homepage: http://github.com/bramswenson/subprocess
|
46
|
+
- README.md
|
47
|
+
homepage: https://github.com/stripe/subprocess
|
108
48
|
licenses: []
|
109
|
-
|
110
49
|
post_install_message:
|
111
|
-
rdoc_options:
|
112
|
-
|
113
|
-
- README.rdoc
|
114
|
-
require_paths:
|
50
|
+
rdoc_options: []
|
51
|
+
require_paths:
|
115
52
|
- lib
|
116
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
requirements:
|
125
|
-
- -
|
126
|
-
- !ruby/object:Gem::Version
|
127
|
-
|
128
|
-
- 0
|
129
|
-
version: "0"
|
53
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
54
|
+
none: false
|
55
|
+
requirements:
|
56
|
+
- - ! '>='
|
57
|
+
- !ruby/object:Gem::Version
|
58
|
+
version: '0'
|
59
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
60
|
+
none: false
|
61
|
+
requirements:
|
62
|
+
- - ! '>='
|
63
|
+
- !ruby/object:Gem::Version
|
64
|
+
version: '0'
|
130
65
|
requirements: []
|
131
|
-
|
132
|
-
|
133
|
-
rubygems_version: 1.3.6
|
66
|
+
rubyforge_project:
|
67
|
+
rubygems_version: 1.8.23
|
134
68
|
signing_key:
|
135
69
|
specification_version: 3
|
136
|
-
summary:
|
70
|
+
summary: A port of Python's subprocess module to Ruby
|
137
71
|
test_files: []
|
138
|
-
|
72
|
+
has_rdoc:
|
data/History.txt
DELETED
data/Manifest.txt
DELETED
@@ -1,46 +0,0 @@
|
|
1
|
-
History.txt
|
2
|
-
Manifest.txt
|
3
|
-
PostInstall.txt
|
4
|
-
README.rdoc
|
5
|
-
Rakefile
|
6
|
-
TODO.rdoc
|
7
|
-
examples/simple.irb
|
8
|
-
examples/simple_timeout.irb
|
9
|
-
features/multiple_popens_sequence.feature
|
10
|
-
features/popen.feature
|
11
|
-
features/popen_over_ssh.feature
|
12
|
-
features/popen_over_ssh_without_blocking.feature
|
13
|
-
features/popen_remote_fails_with_invalid_auth_data.feature
|
14
|
-
features/popen_reports_runtime.feature
|
15
|
-
features/popen_running.feature
|
16
|
-
features/popen_with_timeout.feature
|
17
|
-
features/popen_without_blocking.feature
|
18
|
-
features/step_definitions/common_steps.rb
|
19
|
-
features/step_definitions/multiple_popens_sequence_steps.rb
|
20
|
-
features/step_definitions/popen_over_ssh_steps.rb
|
21
|
-
features/step_definitions/popen_over_ssh_without_blocking_steps.rb
|
22
|
-
features/step_definitions/popen_remote_fails_with_invalid_auth_dat_steps.rb
|
23
|
-
features/step_definitions/popen_reports_runtime_steps.rb
|
24
|
-
features/step_definitions/popen_running_steps.rb
|
25
|
-
features/step_definitions/popen_steps.rb
|
26
|
-
features/step_definitions/popen_with_timeout_steps.rb
|
27
|
-
features/step_definitions/popen_without_blocking_steps.rb
|
28
|
-
features/support/common.rb
|
29
|
-
features/support/env.rb
|
30
|
-
features/support/matchers.rb
|
31
|
-
lib/core_ext/hash.rb
|
32
|
-
lib/core_ext/process_status.rb
|
33
|
-
lib/subprocess.rb
|
34
|
-
lib/subprocess/popen.rb
|
35
|
-
lib/subprocess/popen_factory.rb
|
36
|
-
lib/subprocess/popen_remote.rb
|
37
|
-
lib/subprocess/popen_sequence.rb
|
38
|
-
script/console
|
39
|
-
script/destroy
|
40
|
-
script/generate
|
41
|
-
spec/spec.opts
|
42
|
-
spec/spec_helper.rb
|
43
|
-
spec/subprocess/popen_spec.rb
|
44
|
-
spec/subprocess_spec.rb
|
45
|
-
subprocess.gemspec
|
46
|
-
tasks/rspec.rake
|
data/PostInstall.txt
DELETED
data/README.rdoc
DELETED
@@ -1,77 +0,0 @@
|
|
1
|
-
= subprocess
|
2
|
-
|
3
|
-
* http://github.com/bramswenson/subprocess
|
4
|
-
|
5
|
-
== DESCRIPTION:
|
6
|
-
|
7
|
-
* Subprocess provides a clean wrapper class around the Kernel.exec method.
|
8
|
-
|
9
|
-
== FEATURES/PROBLEMS:
|
10
|
-
|
11
|
-
* Provides working Subprocess::Popen class used to call system commands in and object oriented manner.
|
12
|
-
|
13
|
-
== SYNOPSIS:
|
14
|
-
|
15
|
-
=== Simple Popen
|
16
|
-
|
17
|
-
>> require 'subprocess'
|
18
|
-
=> true
|
19
|
-
>>
|
20
|
-
?> # a process to get the current version of ruby from ruby command
|
21
|
-
?> ruby_version = Subprocess::Popen.new('ruby -v')
|
22
|
-
=> #<Subprocess::Popen:0x7f9220bda3a8 @running=false, @command="ruby -v", @timeout=30, @ipc_parsed=false>
|
23
|
-
>>
|
24
|
-
?> # run the process
|
25
|
-
?> ruby_version.run
|
26
|
-
=> true
|
27
|
-
>>
|
28
|
-
?> # wait on process to complete (blocking method)
|
29
|
-
?> ruby_version.wait
|
30
|
-
=> true
|
31
|
-
>>
|
32
|
-
?> # the process will have stdout
|
33
|
-
?> ruby_version.stdout
|
34
|
-
=> "ruby 1.8.7 (2009-06-12 patchlevel 174) [x86_64-linux]"
|
35
|
-
>>
|
36
|
-
?> # and in this case no stderr
|
37
|
-
?> ruby_version.stderr
|
38
|
-
=> ""
|
39
|
-
>>
|
40
|
-
?> # the complete process info is in status
|
41
|
-
?> ruby_version.status
|
42
|
-
=> {:run_time=>0.0611081123352051, :stopsig=>nil, :exited?=>true, :pid=>16744, :termsig=>nil, :timed_out?=>false, :stopped?=>false, :success?=>true, :exitstatus=>0}
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
== REQUIREMENTS:
|
47
|
-
|
48
|
-
tested on ruby 1.8.7
|
49
|
-
|
50
|
-
== INSTALL:
|
51
|
-
|
52
|
-
[sudo] gem install subprocess
|
53
|
-
|
54
|
-
== LICENSE:
|
55
|
-
|
56
|
-
(The MIT License)
|
57
|
-
|
58
|
-
Copyright (c) 2010 Bram Swenson
|
59
|
-
|
60
|
-
Permission is hereby granted, free of charge, to any person obtaining
|
61
|
-
a copy of this software and associated documentation files (the
|
62
|
-
'Software'), to deal in the Software without restriction, including
|
63
|
-
without limitation the rights to use, copy, modify, merge, publish,
|
64
|
-
distribute, sublicense, and/or sell copies of the Software, and to
|
65
|
-
permit persons to whom the Software is furnished to do so, subject to
|
66
|
-
the following conditions:
|
67
|
-
|
68
|
-
The above copyright notice and this permission notice shall be
|
69
|
-
included in all copies or substantial portions of the Software.
|
70
|
-
|
71
|
-
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
72
|
-
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
73
|
-
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
74
|
-
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
75
|
-
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
76
|
-
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
77
|
-
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/Rakefile
DELETED
@@ -1,20 +0,0 @@
|
|
1
|
-
require 'rubygems'
|
2
|
-
gem 'hoe', '>= 2.1.0'
|
3
|
-
#gem 'rspec', '<= 1.3.0'
|
4
|
-
require 'hoe'
|
5
|
-
require 'fileutils'
|
6
|
-
require './lib/subprocess'
|
7
|
-
|
8
|
-
Hoe.plugin :newgem
|
9
|
-
# Hoe.plugin :website
|
10
|
-
Hoe.plugin :cucumberfeatures
|
11
|
-
|
12
|
-
$hoe = Hoe.spec 'subprocess' do
|
13
|
-
self.developer 'Bram Swenson', 'bram@craniumisajar.com'
|
14
|
-
end
|
15
|
-
|
16
|
-
require 'newgem/tasks'
|
17
|
-
Dir['tasks/**/*.rake'].each { |t| load t }
|
18
|
-
|
19
|
-
remove_task :default
|
20
|
-
task :default => [:spec, :features]
|
data/TODO.rdoc
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
* make sure rails config.gem 'subprocess' works
|
data/examples/simple.irb
DELETED
@@ -1,22 +0,0 @@
|
|
1
|
-
#!/usr/bin/env irb
|
2
|
-
|
3
|
-
begin
|
4
|
-
require 'subprocess'
|
5
|
-
rescue LoadError
|
6
|
-
require 'rubygems'
|
7
|
-
require 'subprocess'
|
8
|
-
end
|
9
|
-
|
10
|
-
# a process to get the current version of ruby from ruby command
|
11
|
-
ruby_version = Subprocess::Popen.new('ruby -v')
|
12
|
-
# run the process
|
13
|
-
ruby_version.run
|
14
|
-
# wait on process to complete (blocking method)
|
15
|
-
ruby_version.wait
|
16
|
-
# the process will have stdout
|
17
|
-
ruby_version.stdout
|
18
|
-
# and in this case no stderr
|
19
|
-
ruby_version.stderr
|
20
|
-
# the complete process info is in status
|
21
|
-
ruby_version.status
|
22
|
-
|
data/examples/simple_timeout.irb
DELETED
@@ -1,22 +0,0 @@
|
|
1
|
-
#!/usr/bin/env irb
|
2
|
-
|
3
|
-
begin
|
4
|
-
require 'subprocess'
|
5
|
-
rescue LoadError
|
6
|
-
require 'rubygems'
|
7
|
-
require 'subprocess'
|
8
|
-
end
|
9
|
-
|
10
|
-
# a process to get the current version of ruby from ruby command
|
11
|
-
ruby_version = Subprocess::Popen.new('ruby -v')
|
12
|
-
# run the process
|
13
|
-
ruby_version.run
|
14
|
-
# wait on process to complete (blocking method)
|
15
|
-
ruby_version.wait
|
16
|
-
# the process will have stdout
|
17
|
-
ruby_version.stdout
|
18
|
-
# and in this case no stderr
|
19
|
-
ruby_version.stderr
|
20
|
-
# the complete process info is in status
|
21
|
-
ruby_version.status
|
22
|
-
|
@@ -1,23 +0,0 @@
|
|
1
|
-
Feature: Run a sequence of simple subprocesses in order
|
2
|
-
|
3
|
-
As a ruby hacker
|
4
|
-
I want to run a sequence of system subprocesses in a sequential order
|
5
|
-
So I can run complex sequences of commands in a simple way
|
6
|
-
|
7
|
-
Scenario: run a sequence of 2 sequential subprocess successfully
|
8
|
-
Given I have a subprocess sequence with 2 subprocesses to run
|
9
|
-
When I run the subprocesses sequence
|
10
|
-
Then the subprocess sequence completes with success
|
11
|
-
And the subprocess sequence has stdout for each subprocess
|
12
|
-
And the subprocess sequence has stderr for each subprocess
|
13
|
-
And the subprocess sequence has status for each subprocess
|
14
|
-
|
15
|
-
Scenario: run a sequence of 2 sequential subprocess where the first fails
|
16
|
-
Given I have a subprocess sequence with 2 subprocesses to run with a bad one first
|
17
|
-
When I run the subprocesses sequence
|
18
|
-
Then the subprocess sequence completes with failure
|
19
|
-
|
20
|
-
Scenario: run a sequence of sequences
|
21
|
-
Given I have a subprocess sequence with 2 subprocesses sequences
|
22
|
-
When I run the sequence
|
23
|
-
Then the sequences run just like any other subprocess
|
data/features/popen.feature
DELETED
@@ -1,45 +0,0 @@
|
|
1
|
-
Feature: Run simple subprocesses in ruby
|
2
|
-
|
3
|
-
As a ruby hacker
|
4
|
-
I want to run system subprocesses
|
5
|
-
And I want to have them presented as objects
|
6
|
-
So that I can get more data about said subprocesses
|
7
|
-
And so that I can have more fine grained control of said subprocesses
|
8
|
-
|
9
|
-
Scenario Outline: run simple subprocesses
|
10
|
-
Given I have a new Subprocess instance initialized with "<command>"
|
11
|
-
When I invoke the run method of said subprocess
|
12
|
-
And I invoke the wait method of said subprocess
|
13
|
-
Then the instance should have a status attribute
|
14
|
-
And the instances exit status is "<exitstatus>"
|
15
|
-
And the instances stdout matches "<stdout>"
|
16
|
-
And the instances stderr matches "<stderr>"
|
17
|
-
And the instance should have a numerical pid
|
18
|
-
|
19
|
-
Scenarios: zero exit code subprocesses with stdout
|
20
|
-
| command | exitstatus | stdout | stderr |
|
21
|
-
| echo 1 | 0 | 1 | |
|
22
|
-
|
23
|
-
Scenarios: zero exit code subprocesses with stderr
|
24
|
-
| command | exitstatus | stdout | stderr |
|
25
|
-
| echo 1 1>&2 | 0 | | 1 |
|
26
|
-
|
27
|
-
Scenarios: zero exit code subprocesses with stdout and stderr
|
28
|
-
| command | exitstatus | stdout | stderr |
|
29
|
-
| echo 1 && echo 1 1>&2 | 0 | 1 | 1 |
|
30
|
-
|
31
|
-
Scenarios: nonzero exit code subprocesses with stdout
|
32
|
-
| command | exitstatus | stdout | stderr |
|
33
|
-
| echo 1 && exit 1 | 1 | 1 | |
|
34
|
-
| echo 1 && exit 2 | 2 | 1 | |
|
35
|
-
| echo 1 && exit 99 | 99 | 1 | |
|
36
|
-
|
37
|
-
Scenarios: nonzero exit code subprocesses with stderr
|
38
|
-
| command | exitstatus | stdout | stderr |
|
39
|
-
| echo 1 1>&2 && exit 1 | 1 | | 1 |
|
40
|
-
|
41
|
-
Scenarios: nonzero exit code subprocesses with stdout and stderr
|
42
|
-
| command | exitstatus | stdout | stderr |
|
43
|
-
| echo 1 && echo 1 1>&2 && exit 1 | 1 | 1 | 1 |
|
44
|
-
|
45
|
-
|