aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--src/tools/launcher/bash_launcher.cc12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/tools/launcher/bash_launcher.cc b/src/tools/launcher/bash_launcher.cc
index cd714abc38..3115c813f0 100644
--- a/src/tools/launcher/bash_launcher.cc
+++ b/src/tools/launcher/bash_launcher.cc
@@ -30,9 +30,15 @@ static constexpr const char* BASH_BIN_PATH = "bash_bin_path";
ExitCode BashBinaryLauncher::Launch() {
wstring bash_binary = this->GetLaunchInfoByKey(BASH_BIN_PATH);
- // If specified bash binary path doesn't exist, then fall back to
- // bash.exe and hope it's in PATH.
- if (!DoesFilePathExist(bash_binary.c_str())) {
+ if (DoesFilePathExist(bash_binary.c_str())) {
+ wstring bash_bin_dir = GetParentDirFromPath(bash_binary);
+ wstring path_env;
+ GetEnv(L"PATH", &path_env);
+ path_env = bash_bin_dir + L";" + path_env;
+ SetEnv(L"PATH", path_env);
+ } else {
+ // If specified bash binary path doesn't exist, then fall back to
+ // bash.exe and hope it's in PATH.
bash_binary = L"bash.exe";
}