blue_shell 0.5 → 0.6
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/lib/blue_shell/bash.rb +5 -2
- data/lib/blue_shell/version.rb +1 -1
- data/spec/blue_shell_spec.rb +15 -9
- metadata +2 -2
data/lib/blue_shell/bash.rb
CHANGED
@@ -24,8 +24,8 @@ module BlueShell
|
|
24
24
|
Timeout::timeout(timeout) do
|
25
25
|
proc = runtime.exec("/bin/bash #{file.path}")
|
26
26
|
|
27
|
-
@out =
|
28
|
-
@err =
|
27
|
+
@out = []
|
28
|
+
@err = []
|
29
29
|
|
30
30
|
# Must have a sink for stdout for the proc to exit
|
31
31
|
out_thread = read_thread(proc.getInputStream, @out)
|
@@ -34,6 +34,9 @@ module BlueShell
|
|
34
34
|
out_thread.join
|
35
35
|
err_thread.join
|
36
36
|
|
37
|
+
@out = @out.join("\n")
|
38
|
+
@err = @err.join("\n")
|
39
|
+
|
37
40
|
@exit = proc.exitValue
|
38
41
|
end
|
39
42
|
ensure
|
data/lib/blue_shell/version.rb
CHANGED
data/spec/blue_shell_spec.rb
CHANGED
@@ -2,21 +2,27 @@ require 'minitest/autorun'
|
|
2
2
|
require 'blue_shell'
|
3
3
|
|
4
4
|
describe BlueShell::Bash do
|
5
|
+
before do
|
6
|
+
@shell = BlueShell::Bash.new
|
7
|
+
end
|
8
|
+
|
5
9
|
it "should return the stdout" do
|
6
|
-
shell
|
7
|
-
shell.
|
8
|
-
shell.out.must_equal "hello"
|
10
|
+
@shell.execute!("echo hello")
|
11
|
+
@shell.out.must_equal "hello"
|
9
12
|
end
|
10
13
|
|
11
14
|
it "should return the stderr" do
|
12
|
-
shell
|
13
|
-
shell.
|
14
|
-
shell.err.must_include "omg: command not found"
|
15
|
+
@shell.execute!("omg")
|
16
|
+
@shell.err.must_include "omg: command not found"
|
15
17
|
end
|
16
18
|
|
17
19
|
it "should return exit status" do
|
18
|
-
shell
|
19
|
-
shell.
|
20
|
-
|
20
|
+
@shell.execute!("echo hello")
|
21
|
+
@shell.exit.must_equal 0
|
22
|
+
end
|
23
|
+
|
24
|
+
it "should properly handle multiple lines" do
|
25
|
+
@shell.execute!("ls -l /")
|
26
|
+
@shell.out.must_include "\n"
|
21
27
|
end
|
22
28
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: blue_shell
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: '0.
|
4
|
+
version: '0.6'
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-11-07 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: minitest
|