command_runner_ng 0.1.0 → 0.1.1
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.
- checksums.yaml +4 -4
- data/lib/command_runner.rb +12 -3
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5ec595e87ef6bc2b18247db034e7f6c16833c7ea
|
4
|
+
data.tar.gz: f35ed38a143ae56e0964d5fb146f47f43217f4ae
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2a5e1afcb667b1d18cecbeb7f5bc998df37a881b6ca3b33b986480faab4264af3189df20c12f2ae82ece3d67e251295d466f0be2ce22f3c06a184e2db039bdcd
|
7
|
+
data.tar.gz: 0c9b71180c50ba117e0c75975e226886608b8eb4f4e9b7ed17d419eba7c70e4bae6148e9d0e2d9601dd993cf6b99469db935cb6f1dc822845f700648fbd51cfd
|
data/lib/command_runner.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
module CommandRunner
|
2
2
|
|
3
|
-
MAX_TIME = Time.new(2**63 -1)
|
3
|
+
MAX_TIME = Time.new(2**63 - 1)
|
4
4
|
|
5
5
|
# Like IO.popen(), but block until the child completes.
|
6
6
|
#
|
@@ -35,7 +35,16 @@ module CommandRunner
|
|
35
35
|
# will be killed with SIGKILL, cleaned up, and the exception rethrown
|
36
36
|
# to the caller of run.
|
37
37
|
#
|
38
|
-
|
38
|
+
# By default stderr in the child is merged into its stdout. You can do any kind
|
39
|
+
# of advanced stream mapping by overriding the default options hash. The options are passed to Kernel.spawn.
|
40
|
+
# See https://ruby-doc.org/core-2.2.3/Kernel.html#method-i-spawn for details.
|
41
|
+
#
|
42
|
+
# Fx. redirecting stderr to /dev/null would look like:
|
43
|
+
# run('ls', 'nosuchfile', options: {:err => "/dev/null"})
|
44
|
+
#
|
45
|
+
# All Kernel.spawn features, like setting umasks, process group, and are supported through the options hash.
|
46
|
+
#
|
47
|
+
def self.run(*args, timeout: nil, environment: {}, options: {:err=>[:child, :out]})
|
39
48
|
# If args is an array of strings, allow that as a shorthand for [arg1, arg2, arg3]
|
40
49
|
if args.length > 1 && args.all? {|arg| arg.is_a? String}
|
41
50
|
args = [args]
|
@@ -68,7 +77,7 @@ module CommandRunner
|
|
68
77
|
end
|
69
78
|
|
70
79
|
# Spawn child, merging stderr into stdout
|
71
|
-
io = IO.popen(environment, *args,
|
80
|
+
io = IO.popen(environment, *args, options)
|
72
81
|
data = ""
|
73
82
|
|
74
83
|
# Run through all deadlines until command completes.
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: command_runner_ng
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mikkel Kamstrup Erlandsen
|
@@ -27,17 +27,17 @@ require_paths:
|
|
27
27
|
- lib
|
28
28
|
required_ruby_version: !ruby/object:Gem::Requirement
|
29
29
|
requirements:
|
30
|
-
- -
|
30
|
+
- - ">="
|
31
31
|
- !ruby/object:Gem::Version
|
32
32
|
version: 2.0.0
|
33
33
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
34
34
|
requirements:
|
35
|
-
- -
|
35
|
+
- - ">="
|
36
36
|
- !ruby/object:Gem::Version
|
37
37
|
version: '0'
|
38
38
|
requirements: []
|
39
39
|
rubyforge_project:
|
40
|
-
rubygems_version: 2.
|
40
|
+
rubygems_version: 2.5.1
|
41
41
|
signing_key:
|
42
42
|
specification_version: 4
|
43
43
|
summary: Command Runner NG
|