From ae38c5d6d122f3c3b7a25c5e0377b0de9bcc1d2a Mon Sep 17 00:00:00 2001 From: Markus Reiter Date: Wed, 11 Jul 2018 09:24:40 +0200 Subject: [PATCH] Fix `SystemCommand` `PATH`. --- Library/Homebrew/cask/lib/hbc/system_command.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Library/Homebrew/cask/lib/hbc/system_command.rb b/Library/Homebrew/cask/lib/hbc/system_command.rb index 2da4d2c677..c21e87d8e8 100644 --- a/Library/Homebrew/cask/lib/hbc/system_command.rb +++ b/Library/Homebrew/cask/lib/hbc/system_command.rb @@ -97,7 +97,11 @@ module Hbc executable, *args = expanded_command raw_stdin, raw_stdout, raw_stderr, raw_wait_thr = - Open3.popen3(env, [executable, executable], *args, **options) + # We need to specifically use `with_env` for `PATH`, otherwise + # Ruby itself will not look for the executable in `PATH`. + with_env "PATH" => env["PATH"] do + Open3.popen3(env, [executable, executable], *args, **options) + end write_input_to(raw_stdin) raw_stdin.close_write