subprocess 1.3.0 → 1.3.2
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.
- checksums.yaml +4 -4
- data/README.md +21 -19
- data/lib/subprocess.rb +8 -8
- data/lib/subprocess/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 28480023adb6bb4e7bff7096e766e6be65ff9421
|
4
|
+
data.tar.gz: 3ad723848b5a45e44fad49d967c0787d1d24f108
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 566d18db86adb9950509f92d4efa608475c9c9d9ccc174e11c06ee2fa128eadc6c8fbc22ab49404abed394c930a0750a4de5eb489dcc8761a72c4fb3b6a043e0
|
7
|
+
data.tar.gz: f9c2d1307de9dfcf067eeda605182456872dc16ef0948348db488fd0103d080ea296cba486b9b5448c712fb188cb23e1feacb4ce8f08c7647b1be766205a02c0
|
data/README.md
CHANGED
@@ -1,14 +1,8 @@
|
|
1
|
-
# Subprocess [](https://travis-ci.org/stripe/subprocess)
|
1
|
+
# Subprocess [](https://travis-ci.org/stripe/subprocess) [](http://rubydoc.info/github/stripe/subprocess/Subprocess)
|
2
2
|
|
3
3
|

|
4
4
|
|
5
|
-
A
|
6
|
-
|
7
|
-
Many thanks to [Bram Swenson][bram], the author of the old [subprocess][old]
|
8
|
-
gem, for graciously letting us use the name.
|
9
|
-
|
10
|
-
[bram]: https://github.com/bramswenson
|
11
|
-
[old]: https://github.com/bramswenson/subprocess
|
5
|
+
A solid subprocess library for ruby, inspired by python's.
|
12
6
|
|
13
7
|
Installation
|
14
8
|
------------
|
@@ -21,20 +15,10 @@ You can also build `subprocess` from source by running:
|
|
21
15
|
|
22
16
|
$ gem build subprocess.gemspec
|
23
17
|
|
24
|
-
|
25
18
|
Usage
|
26
19
|
-----
|
27
20
|
|
28
|
-
|
29
|
-
equally well to this gem as well. While there are a few places when our
|
30
|
-
semantics differs from Python's, users of the Python module should largely feel
|
31
|
-
at home using `subprocess`. We have attempted to [document][rubydoc] all of the
|
32
|
-
differences, but if we have missed something, please file an issue.
|
33
|
-
|
34
|
-
[python]: http://docs.python.org/library/subprocess.html
|
35
|
-
[rubydoc]: http://rubydoc.info/github/stripe/subprocess
|
36
|
-
|
37
|
-
A few examples:
|
21
|
+
Full documentation is on [RubyDoc][rubydoc]. A few examples:
|
38
22
|
|
39
23
|
```ruby
|
40
24
|
require 'subprocess'
|
@@ -71,3 +55,21 @@ http://upload.wikimedia.org/wikipedia/commons/3/3e/Unshorn_alpaca_grazing.jpg
|
|
71
55
|
EMAIL
|
72
56
|
end
|
73
57
|
```
|
58
|
+
|
59
|
+
Most of the documentation for Python's [subprocess][python] module applies
|
60
|
+
equally well to this gem as well. While there are a few places when our
|
61
|
+
semantics differs from Python's, users of the Python module should largely feel
|
62
|
+
at home using `subprocess`. We have attempted to [document][rubydoc] all of the
|
63
|
+
differences, but if we have missed something, please file an issue.
|
64
|
+
|
65
|
+
[python]: http://docs.python.org/library/subprocess.html
|
66
|
+
[rubydoc]: http://rubydoc.info/github/stripe/subprocess/Subprocess
|
67
|
+
|
68
|
+
Acknowledgements
|
69
|
+
----------------
|
70
|
+
|
71
|
+
Many thanks to [Bram Swenson][bram], the author of the old [subprocess][old]
|
72
|
+
gem, for graciously letting us use the name.
|
73
|
+
|
74
|
+
[bram]: https://github.com/bramswenson
|
75
|
+
[old]: https://github.com/bramswenson/subprocess
|
data/lib/subprocess.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
require 'fileutils'
|
1
2
|
require 'thread'
|
2
3
|
require 'set'
|
3
4
|
|
@@ -107,14 +108,7 @@ module Subprocess
|
|
107
108
|
# been according to the usual exit status convention
|
108
109
|
sig_num = status.exitstatus - 128
|
109
110
|
|
110
|
-
|
111
|
-
if Signal.respond_to?(:signame)
|
112
|
-
# ruby 2.0 way
|
113
|
-
sig_name = Signal.signame(sig_num)
|
114
|
-
else
|
115
|
-
# ruby 1.9 way
|
116
|
-
sig_name = Signal.list.key(sig_num)
|
117
|
-
end
|
111
|
+
sig_name = Signal.signame(sig_num)
|
118
112
|
|
119
113
|
if sig_name
|
120
114
|
parts << "(maybe SIG#{sig_name})"
|
@@ -368,6 +362,9 @@ module Subprocess
|
|
368
362
|
raise ArgumentError if !input.nil? && @stdin.nil?
|
369
363
|
|
370
364
|
stdout, stderr = "", ""
|
365
|
+
stdout_encoding = @stdout.external_encoding if @stdout
|
366
|
+
stderr_encoding = @stderr.external_encoding if @stderr
|
367
|
+
|
371
368
|
input = input.dup unless input.nil?
|
372
369
|
|
373
370
|
@stdin.close if (input.nil? || input.empty?) && !@stdin.nil?
|
@@ -429,6 +426,9 @@ module Subprocess
|
|
429
426
|
|
430
427
|
wait
|
431
428
|
|
429
|
+
stdout.force_encoding(stdout_encoding) if stdout_encoding
|
430
|
+
stderr.force_encoding(stderr_encoding) if stderr_encoding
|
431
|
+
|
432
432
|
[stdout, stderr]
|
433
433
|
end
|
434
434
|
|
data/lib/subprocess/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: subprocess
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.3.
|
4
|
+
version: 1.3.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Carl Jackson
|
@@ -12,7 +12,7 @@ authors:
|
|
12
12
|
autorequire:
|
13
13
|
bindir: bin
|
14
14
|
cert_chain: []
|
15
|
-
date: 2016-
|
15
|
+
date: 2016-08-17 00:00:00.000000000 Z
|
16
16
|
dependencies:
|
17
17
|
- !ruby/object:Gem::Dependency
|
18
18
|
name: minitest
|