forked from OSchip/llvm-project
Provide more information when process launch can't change directory to the
path passed with -w Test this functionality. llvm-svn: 160130
This commit is contained in:
parent
fdce33a495
commit
0c251adf75
|
@ -1532,7 +1532,16 @@ LaunchProcessPosixSpawn (const char *exe_path, ProcessLaunchInfo &launch_info, :
|
|||
if (working_dir)
|
||||
{
|
||||
// No more thread specific current working directory
|
||||
__pthread_chdir (working_dir);
|
||||
if (__pthread_chdir (working_dir) < 0) {
|
||||
if (errno == ENOENT) {
|
||||
error.SetErrorStringWithFormat("No such file or directory: %s", working_dir);
|
||||
} else if (errno == ENOTDIR) {
|
||||
error.SetErrorStringWithFormat("Path doesn't name a directory: %s", working_dir);
|
||||
} else {
|
||||
error.SetErrorStringWithFormat("An unknown error occurred when changing directory for process execution.");
|
||||
}
|
||||
return error;
|
||||
}
|
||||
}
|
||||
|
||||
const size_t num_file_actions = launch_info.GetNumFileActions ();
|
||||
|
|
|
@ -139,6 +139,15 @@ class ProcessLaunchTestCase(TestBase):
|
|||
except OSError:
|
||||
pass
|
||||
|
||||
# Check that we get an error when we have a nonexisting path
|
||||
launch_command = "process launch -w %s -o %s -e %s" % (my_working_dir_path + 'z',
|
||||
out_file_path,
|
||||
err_file_path)
|
||||
|
||||
self.expect(launch_command, error=True,
|
||||
startstr = "error: No such file or directory: %sz" % my_working_dir_path)
|
||||
|
||||
# Really launch the process
|
||||
launch_command = "process launch -w %s -o %s -e %s" % (my_working_dir_path,
|
||||
out_file_path,
|
||||
err_file_path)
|
||||
|
|
Loading…
Reference in New Issue