bkoski-better_backticks 0.5.0 → 0.5.1
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/kernel.rb +2 -2
- data/test/test_kernel.rb +4 -4
- metadata +11 -3
data/lib/kernel.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
module Kernel
|
2
2
|
|
3
3
|
# Override raises an error if _cmd_ returns a non-zero exit status.
|
4
|
-
# Returns stdout
|
4
|
+
# Returns stdout if _cmd_ succeeds. Note that these are simply concatenated; STDERR is not inline.
|
5
5
|
def ` cmd
|
6
6
|
stdout, stderr = ''
|
7
7
|
|
@@ -15,7 +15,7 @@ module Kernel
|
|
15
15
|
raise "'#{cmd}' failed with: '#{e.message}'"
|
16
16
|
end
|
17
17
|
|
18
|
-
return stdout
|
18
|
+
return stdout
|
19
19
|
end
|
20
20
|
|
21
21
|
alias_method :system!, :system
|
data/test/test_kernel.rb
CHANGED
@@ -19,8 +19,8 @@ class TestKernel < Test::Unit::TestCase
|
|
19
19
|
assert_match "failed with: 'No such file or directory - bad-cmd'", exception.message
|
20
20
|
end
|
21
21
|
|
22
|
-
should "return the contents of stdout
|
23
|
-
assert_match "std out\
|
22
|
+
should "return the contents of stdout if command succeeds" do
|
23
|
+
assert_match "std out\n", `echo "std out"; echo "std err output" >&2; exit 0;`
|
24
24
|
end
|
25
25
|
end
|
26
26
|
|
@@ -33,8 +33,8 @@ class TestKernel < Test::Unit::TestCase
|
|
33
33
|
assert_match "failed with: 'error text on stderr'", exception.message
|
34
34
|
end
|
35
35
|
|
36
|
-
should "return the contents of stdout
|
37
|
-
assert_match "std out\
|
36
|
+
should "return the contents of stdout if command succeeds" do
|
37
|
+
assert_match "std out\n", %x{echo "std out"; echo "std err output" >&2; exit 0;}
|
38
38
|
end
|
39
39
|
end
|
40
40
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bkoski-better_backticks
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ben Koski
|
@@ -11,8 +11,16 @@ cert_chain: []
|
|
11
11
|
|
12
12
|
date: 2009-01-28 00:00:00 -08:00
|
13
13
|
default_executable:
|
14
|
-
dependencies:
|
15
|
-
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: open4
|
17
|
+
version_requirement:
|
18
|
+
version_requirements: !ruby/object:Gem::Requirement
|
19
|
+
requirements:
|
20
|
+
- - ">="
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: 0.9.6
|
23
|
+
version:
|
16
24
|
description: TODO
|
17
25
|
email: gems@benkoski.com
|
18
26
|
executables: []
|