Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 87223e2

Browse files
committed
Stop Chef::Exceptions::ShellCommandFailed deprecation messages
Checking for a non-zero exit code accomplishes the same thing as rescuing *::ShellCommandFailed.
1 parent 492d2d8 commit 87223e2

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

providers/pip.rb

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -114,10 +114,8 @@ def current_installed_version
114114
delimeter = /\s/
115115
version_check_cmd = "pip --version"
116116
end
117-
p = shell_out!(version_check_cmd)
118-
p.stdout.split(delimeter)[1].strip
119-
rescue Chef::Exceptions::ShellCommandFailed
120-
rescue Mixlib::ShellOut::ShellCommandFailed
117+
result = shell_out(version_check_cmd)
118+
(result.exitstatus == 0) ? result.stdout.split(delimeter)[1].strip : nil
121119
end
122120
end
123121

0 commit comments

Comments
 (0)