mirror of
https://github.com/google/cdc-file-transfer.git
synced 2026-09-13 01:10:44 +03:00
[common] Add a way to set the process startup directory (#63)
This will be needed later for switching to sftp, since calling lcd in sftp is tricky to get right (e.g. may or may not require /cygwin/c on Windows, depending on whether sftp is native or not).
This commit is contained in:
@@ -342,5 +342,20 @@ TEST_F(ProcessTest, TerminateAlreadyExited) {
|
||||
EXPECT_OK(process->Terminate());
|
||||
}
|
||||
|
||||
TEST_F(ProcessTest, StartupDir) {
|
||||
ProcessStartInfo start_info;
|
||||
start_info.command = "cmd /C cd";
|
||||
start_info.startup_dir = "C:\\";
|
||||
|
||||
std::string std_out;
|
||||
start_info.stdout_handler = [&std_out](const char* data, size_t) {
|
||||
std_out += data;
|
||||
return absl::OkStatus();
|
||||
};
|
||||
|
||||
EXPECT_OK(process_factory_.Run(start_info));
|
||||
EXPECT_EQ(std_out, "C:\\\r\n");
|
||||
}
|
||||
|
||||
} // namespace
|
||||
} // namespace cdc_ft
|
||||
|
||||
Reference in New Issue
Block a user