cmd2json 0.1.1 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1776ecf5855f37c7cd810f89ec568635c5a887c3
4
- data.tar.gz: 81f34b3d6f9a6f0b9c683c0b0956fcea7cb1277f
3
+ metadata.gz: becb4451af48f24199de8e1baf36a6e11c5229f3
4
+ data.tar.gz: e340d7d38551c3f87aca4a5ccb383c3f0038e246
5
5
  SHA512:
6
- metadata.gz: a9b018a57cef46bf5579d2c8efb6e2d53a304424a0ec215505a8e25a1cfeaf196b7020f2cfc68846f9cf2f7739c7b05f952f7f7905bcb384e27818830895df6e
7
- data.tar.gz: 11a9fe137ca199a04f7220704ebb383fec45fd8118c803847e367267c96edffc5406dbff0da3dc7d7c0a0f22fcf724bfcf5b5f6cd5ac229d41235ed4232ff10e
6
+ metadata.gz: 025c6cbe443c4d634569e8793dcc659844e16a965dae6646a82ac42dd5bdd3c99513c885165031fd892e18542ad34cd02b84ec67948105827148bfee64de22a4
7
+ data.tar.gz: 00c255acec0f3362ea3540306c594099854c89a554e8df59202197b15b79d575ee4ace9f6f95534bba9adedfa0fa4ca0994ff8f4439dabce7525b99fb2fee528
data/lib/cmd2json.rb CHANGED
@@ -3,14 +3,23 @@ require 'socket'
3
3
 
4
4
  module Cmd2Json
5
5
  def self.run(argv, options={})
6
+ out = ""
6
7
  begin
7
- out = ""
8
8
  IO.popen(argv, err: [:child, :out]) { |io| out = io.read }
9
- status = $?.exitstatus
10
- rescue Errno::ENOENT
9
+
10
+ # log when subprocess was killed, need manual testing as integration test
11
+ unless status = $?.exitstatus
12
+ out << "\nKilled"
13
+ status = 1
14
+ end
15
+ rescue Errno::ENOENT # executable not found
11
16
  out = $!.message
12
17
  status = 1
18
+ rescue SignalException # need manual testing as integration test
19
+ out << "\nKilled #{$!}"
20
+ status = 1
13
21
  end
22
+
14
23
  result = {message: out, exit: status}
15
24
  result['@timestamp'] = Time.now if options[:timestamp]
16
25
  result[:host] = Socket.gethostname if options[:host]
@@ -1,3 +1,3 @@
1
1
  module Cmd2Json
2
- VERSION = "0.1.1"
2
+ VERSION = "0.2.0"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cmd2json
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Grosser