subprocess 0.15 → 0.16
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/README.md +5 -5
- data/lib/subprocess.rb +4 -4
- metadata +4 -3
data/README.md
CHANGED
@@ -44,7 +44,7 @@ Check user's animal allegiances:
|
|
44
44
|
```ruby
|
45
45
|
begin
|
46
46
|
Subprocess.check_call(['grep', '-q', 'llamas', '~/favorite_animals'])
|
47
|
-
rescue NonZeroExit => e
|
47
|
+
rescue Subprocess::NonZeroExit => e
|
48
48
|
puts e.message
|
49
49
|
puts "Why aren't llamas one of your favorite animals?"
|
50
50
|
end
|
@@ -53,20 +53,20 @@ end
|
|
53
53
|
Parse the output of `uptime(1)` to find the system's load:
|
54
54
|
|
55
55
|
```ruby
|
56
|
-
|
56
|
+
system_load = Subprocess.check_output(['uptime']).split(' ').last(3)
|
57
57
|
```
|
58
58
|
|
59
59
|
Send mail to your friends with `sendmail(1)`:
|
60
60
|
|
61
61
|
```ruby
|
62
|
-
Subprocess.check_call(%W{sendmail -t},
|
63
|
-
:stdin => Subprocess::PIPE, :stdout => Subprocess::PIPE) do |p|
|
62
|
+
Subprocess.check_call(%W{sendmail -t}, :stdin => Subprocess::PIPE) do |p|
|
64
63
|
p.communicate <<-EMAIL
|
65
64
|
From: alpaca@example.com
|
66
65
|
To: llama@example.com
|
67
66
|
Subject: I am so fluffy.
|
68
67
|
|
69
|
-
|
68
|
+
SO FLUFFY!
|
69
|
+
http://upload.wikimedia.org/wikipedia/commons/3/3e/Unshorn_alpaca_grazing.jpg
|
70
70
|
EMAIL
|
71
71
|
end
|
72
72
|
```
|
data/lib/subprocess.rb
CHANGED
@@ -40,14 +40,14 @@ module Subprocess
|
|
40
40
|
# Subprocess.check_call(%W{grep -q llama ~/favorite_animals})
|
41
41
|
#
|
42
42
|
# @example Communicate with a child process
|
43
|
-
# Subprocess.check_call(%W{sendmail -t},
|
44
|
-
# :stdin => Subprocess::PIPE, :stdout => Subprocess::PIPE) do |p|
|
43
|
+
# Subprocess.check_call(%W{sendmail -t}, :stdin => Subprocess::PIPE) do |p|
|
45
44
|
# p.communicate <<-EMAIL
|
46
45
|
# From: alpaca@example.com
|
47
46
|
# To: llama@example.com
|
48
47
|
# Subject: I am so fluffy.
|
49
48
|
#
|
50
|
-
#
|
49
|
+
# SO FLUFFY!
|
50
|
+
# http://upload.wikimedia.org/wikipedia/commons/3/3e/Unshorn_alpaca_grazing.jpg
|
51
51
|
# EMAIL
|
52
52
|
# end
|
53
53
|
#
|
@@ -71,7 +71,7 @@ module Subprocess
|
|
71
71
|
# like `Kernel#system`.
|
72
72
|
#
|
73
73
|
# @example Get the system load
|
74
|
-
#
|
74
|
+
# system_load = Subprocess.check_output(['uptime']).split(' ').last(3)
|
75
75
|
#
|
76
76
|
# @raise [NonZeroExit] if the process returned a non-zero exit status (i.e.,
|
77
77
|
# was terminated with an error or was killed by a signal)
|
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: '0.
|
4
|
+
version: '0.16'
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -13,7 +13,7 @@ authors:
|
|
13
13
|
autorequire:
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
|
-
date: 2013-09-
|
16
|
+
date: 2013-09-30 00:00:00.000000000 Z
|
17
17
|
dependencies:
|
18
18
|
- !ruby/object:Gem::Dependency
|
19
19
|
name: minitest
|
@@ -45,7 +45,8 @@ files:
|
|
45
45
|
- lib/subprocess.rb
|
46
46
|
- README.md
|
47
47
|
homepage: https://github.com/stripe/subprocess
|
48
|
-
licenses:
|
48
|
+
licenses:
|
49
|
+
- MIT
|
49
50
|
post_install_message:
|
50
51
|
rdoc_options: []
|
51
52
|
require_paths:
|