mixlib-shellout 3.1.4-universal-mingw32 → 3.1.6-universal-mingw32

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
  SHA256:
3
- metadata.gz: 15cf083a72ce549add81eded313d884cd178385d8fe28c5e3d7d93b40a728b21
4
- data.tar.gz: 619c1ffb3a1c8e78215c97acbf850e5908106e187b4cabc42b0132a4d94a86b7
3
+ metadata.gz: dceb80e3fced860900c612e990a7dcec95a3bbc940520fbe984407f6989cf795
4
+ data.tar.gz: 7250e65e3ed3ccb0c157563daef66d6cab98f04162fab1e2a6f8984f7cc16f06
5
5
  SHA512:
6
- metadata.gz: 0c973fdde62a84ab9a62a37f66ec022aed6ca32011e8855e7d9d6a54e4970ded0d59537dd147c3b830428745dfa60ac546edc63cd99f5f2dc6e8cf565a592cba
7
- data.tar.gz: 9771450ddf8fca070cb8013d623e605fb35476a2472d7d2ac1a5b8ed6e6cd00b19b4c13b284e5f6d435c901bfbed5f8f1952076131966196b1484f6279706ad5
6
+ metadata.gz: 509f7ab8d7abb0edc51ac6e7bf46e503c03ffc3a6b5ba112c6c5e81bbf85d9af7a52a1217985d409903e7cf16442e118609cee0a99fd44fefcee0c64ce8c4ac1
7
+ data.tar.gz: f7b814ff519e2d5836d9b554bd33b0bf0882a4f8627521d0673ea9efd195be5899e73fb0db90fe0505741b153b2a194320367d0b973d14c8e55c78dfe920376d
@@ -248,7 +248,7 @@ module Mixlib
248
248
  # running or died without setting an exit status (e.g., terminated by
249
249
  # `kill -9`).
250
250
  def exitstatus
251
- @status && @status.exitstatus
251
+ @status&.exitstatus
252
252
  end
253
253
 
254
254
  # Run the command, writing the command's standard out and standard error
@@ -157,7 +157,7 @@ module Mixlib
157
157
  end
158
158
 
159
159
  def __io_for_live_stream
160
- if STDOUT.tty? && !__config[:daemon] && __log.debug?
160
+ if !STDOUT.closed? && __log.trace?
161
161
  STDOUT
162
162
  else
163
163
  nil
@@ -370,11 +370,11 @@ module Mixlib
370
370
  return if attempt_reap
371
371
 
372
372
  @terminate_reason = "Command exceeded allowed execution time, process terminated"
373
- logger.error("Command exceeded allowed execution time, sending TERM") if logger
373
+ logger&.error("Command exceeded allowed execution time, sending TERM")
374
374
  Process.kill(:TERM, child_pgid)
375
375
  sleep 3
376
376
  attempt_reap
377
- logger.error("Command exceeded allowed execution time, sending KILL") if logger
377
+ logger&.error("Command exceeded allowed execution time, sending KILL")
378
378
  Process.kill(:KILL, child_pgid)
379
379
  reap
380
380
 
@@ -1,5 +1,5 @@
1
1
  module Mixlib
2
2
  class ShellOut
3
- VERSION = "3.1.4".freeze
3
+ VERSION = "3.1.6".freeze
4
4
  end
5
5
  end
@@ -89,7 +89,7 @@ module Mixlib
89
89
  # Start the process
90
90
  #
91
91
  process, profile, token = Process.create3(create_process_args)
92
- logger.debug(format_process(process, app_name, command_line, timeout)) if logger
92
+ logger&.debug(format_process(process, app_name, command_line, timeout))
93
93
  begin
94
94
  # Start pushing data into input
95
95
  stdin_write << input if input
@@ -124,7 +124,7 @@ module Mixlib
124
124
  kill_process_tree(process.process_id, wmi, logger)
125
125
  Process.kill(:KILL, process.process_id)
126
126
  rescue SystemCallError
127
- logger.warn("Failed to kill timed out process #{process.process_id}") if logger
127
+ logger&.warn("Failed to kill timed out process #{process.process_id}")
128
128
  end
129
129
 
130
130
  raise Mixlib::ShellOut::CommandTimeout, [
@@ -398,20 +398,16 @@ module Mixlib
398
398
 
399
399
  def kill_process(instance, logger)
400
400
  child_pid = instance.wmi_ole_object.processid
401
- if logger
402
- logger.debug([
401
+ logger&.debug([
403
402
  "killing child process #{child_pid}::",
404
403
  "#{instance.wmi_ole_object.Name} of parent #{pid}",
405
404
  ].join)
406
- end
407
405
  Process.kill(:KILL, instance.wmi_ole_object.processid)
408
406
  rescue SystemCallError
409
- if logger
410
- logger.debug([
407
+ logger&.debug([
411
408
  "Failed to kill child process #{child_pid}::",
412
409
  "#{instance.wmi_ole_object.Name} of parent #{pid}",
413
410
  ].join)
414
- end
415
411
  end
416
412
 
417
413
  def format_process(process, app_name, command_line, timeout)
@@ -21,7 +21,6 @@ require "win32/process"
21
21
 
22
22
  # Add new constants for Logon
23
23
  module Process::Constants
24
- private
25
24
 
26
25
  LOGON32_LOGON_INTERACTIVE = 0x00000002
27
26
  LOGON32_LOGON_BATCH = 0x00000004
@@ -148,15 +147,13 @@ module Process
148
147
  si_hash = {}
149
148
 
150
149
  # If the startup_info key is present, validate its subkeys
151
- if hash["startup_info"]
152
- hash["startup_info"].each do |key, val|
153
- key = key.to_s.downcase
154
- unless valid_si_keys.include?(key)
155
- raise ArgumentError, "invalid startup_info key '#{key}'"
156
- end
157
-
158
- si_hash[key] = val
150
+ hash["startup_info"]&.each do |key, val|
151
+ key = key.to_s.downcase
152
+ unless valid_si_keys.include?(key)
153
+ raise ArgumentError, "invalid startup_info key '#{key}'"
159
154
  end
155
+
156
+ si_hash[key] = val
160
157
  end
161
158
 
162
159
  # The +command_line+ key is mandatory unless the +app_name+ key
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mixlib-shellout
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.1.4
4
+ version: 3.1.6
5
5
  platform: universal-mingw32
6
6
  authors:
7
7
  - Chef Software Inc.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-08-13 00:00:00.000000000 Z
11
+ date: 2020-09-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: chef-utils