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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/command_runner.rb +12 -3
  3. metadata +4 -4
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e6de27ba13c1082bff813ee1eb2aec4c84dfe69f
4
- data.tar.gz: 48227b83ec2908c902859d7468f10cf55bbd6975
3
+ metadata.gz: 5ec595e87ef6bc2b18247db034e7f6c16833c7ea
4
+ data.tar.gz: f35ed38a143ae56e0964d5fb146f47f43217f4ae
5
5
  SHA512:
6
- metadata.gz: b90ebd4992561b21a8b83c1de423254f8d114a97e79723d2b37f9a631380e9809689995d3c0b1a9a4ea98b745a870d37018429ec9be273fb764cecee78c0d9ce
7
- data.tar.gz: d0e854031e48f9fa0f06c7f220ecadc9bd31ae98bbd041d346b3346ff3774c7f6b6a0badffb3505d4c816ccc3f06c5f06ba62ddcd3ed886a038fe14b67accfcd
6
+ metadata.gz: 2a5e1afcb667b1d18cecbeb7f5bc998df37a881b6ca3b33b986480faab4264af3189df20c12f2ae82ece3d67e251295d466f0be2ce22f3c06a184e2db039bdcd
7
+ data.tar.gz: 0c9b71180c50ba117e0c75975e226886608b8eb4f4e9b7ed17d419eba7c70e4bae6148e9d0e2d9601dd993cf6b99469db935cb6f1dc822845f700648fbd51cfd
@@ -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
- def self.run(*args, timeout: nil, environment: {})
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, {:err=>[:child, :out]})
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.0
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.0.2
40
+ rubygems_version: 2.5.1
41
41
  signing_key:
42
42
  specification_version: 4
43
43
  summary: Command Runner NG