diff --git a/lldb/source/Host/macosx/Host.mm b/lldb/source/Host/macosx/Host.mm index 57be7d862d7d..8899b9c675c2 100644 --- a/lldb/source/Host/macosx/Host.mm +++ b/lldb/source/Host/macosx/Host.mm @@ -1371,7 +1371,13 @@ Host::ShellExpandArguments (ProcessLaunchInfo &launch_info) int status; std::string output; - RunShellCommand(expand_command, launch_info.GetWorkingDirectory(), &status, nullptr, &output, 10); + FileSpec cwd(launch_info.GetWorkingDirectory()); + if (!cwd.Exists()) + { + error.SetErrorStringWithFormat("cwd does not exist; cannot launch with shell argument expansion"); + return error; + } + RunShellCommand(expand_command, cwd, &status, nullptr, &output, 10); if (status != 0) {