diff options
author | Tim Smith <tsmith84@gmail.com> | 2020-09-09 15:26:16 -0700 |
---|---|---|
committer | Tim Smith <tsmith84@gmail.com> | 2020-09-09 15:26:16 -0700 |
commit | e722fe8ca23533f83c3c6979c95bf2a160069c41 (patch) | |
tree | 68a05425d120612df21d0c26225895d0035bba31 /lib/mixlib/shellout/windows | |
parent | e2a43f613ff1830175716acd541cf3bc921183d6 (diff) | |
download | mixlib-shellout-safe.tar.gz |
Simplify things a bit with &.safe
Use the latest and greatest ruby-isms to cut down on some code.
Signed-off-by: Tim Smith <tsmith@chef.io>
Diffstat (limited to 'lib/mixlib/shellout/windows')
-rw-r--r-- | lib/mixlib/shellout/windows/core_ext.rb | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/lib/mixlib/shellout/windows/core_ext.rb b/lib/mixlib/shellout/windows/core_ext.rb index 621efb9..1c2830b 100644 --- a/lib/mixlib/shellout/windows/core_ext.rb +++ b/lib/mixlib/shellout/windows/core_ext.rb @@ -21,7 +21,6 @@ require "win32/process" # Add new constants for Logon module Process::Constants - private LOGON32_LOGON_INTERACTIVE = 0x00000002 LOGON32_LOGON_BATCH = 0x00000004 @@ -148,15 +147,13 @@ module Process si_hash = {} # If the startup_info key is present, validate its subkeys - if hash["startup_info"] - hash["startup_info"].each do |key, val| - key = key.to_s.downcase - unless valid_si_keys.include?(key) - raise ArgumentError, "invalid startup_info key '#{key}'" - end - - si_hash[key] = val + hash["startup_info"]&.each do |key, val| + key = key.to_s.downcase + unless valid_si_keys.include?(key) + raise ArgumentError, "invalid startup_info key '#{key}'" end + + si_hash[key] = val end # The +command_line+ key is mandatory unless the +app_name+ key |