blue_shell 0.0.1 → 0.0.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.
@@ -7,6 +7,8 @@ module BlueShell
7
7
  BufferedReader = java.io.BufferedReader
8
8
  InputStreamReader = java.io.InputStreamReader
9
9
 
10
+ attr_reader :out, :err, :exit
11
+
10
12
  # Execute the given command. Will block until the command completes.
11
13
  # param [String] the command to execute in bash
12
14
  # param [Integer] the number of seconds to wait for it to complete
@@ -21,7 +23,9 @@ module BlueShell
21
23
 
22
24
  Timeout::timeout(timeout) do
23
25
  @proc = runtime.exec("/bin/bash #{file.path}")
24
- @proc.waitFor
26
+ @out = stream_to_string(@proc.getInputStream)
27
+ @err = stream_to_string(@proc.getErrorStream)
28
+ @exit = @proc.exitValue
25
29
  end
26
30
  ensure
27
31
  file.close
@@ -29,24 +33,6 @@ module BlueShell
29
33
  end
30
34
  end
31
35
 
32
- # Return the stdout of the process
33
- # return [String] the full stdout output
34
- def out
35
- stream_to_string(@proc.getInputStream)
36
- end
37
-
38
- # Return the stderr of the process
39
- # return [String] the full stderr output
40
- def err
41
- stream_to_string(@proc.getErrorStream)
42
- end
43
-
44
- # Return the exit value of the process
45
- # return [Integer] the process' exit value
46
- def exit
47
- @proc.exitValue
48
- end
49
-
50
36
  def stream_to_string(stream)
51
37
  br = BufferedReader.new(InputStreamReader.new(stream))
52
38
  line = nil
@@ -65,4 +51,4 @@ module BlueShell
65
51
  end
66
52
  private :runtime
67
53
  end
68
- end
54
+ end
@@ -1,3 +1,3 @@
1
1
  module BlueShell
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  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.0.1
4
+ version: 0.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: