PIProcess windows works

This commit is contained in:
2025-08-13 21:36:13 +03:00
parent 3625afa783
commit d6a0ae6106
2 changed files with 50 additions and 22 deletions

View File

@@ -9,7 +9,7 @@ protected:
PIProcess launcher;
const PIString command =
#ifdef _WIN32
"cmd.exe";
"C:/Windows/System32/cmd.exe";
#else
"/bin/sh";
#endif
@@ -61,7 +61,7 @@ TEST_F(ProcessTest, Output) {
TEST_F(ProcessTest, Input) {
#ifdef _WIN32
const PIStringList args = {"/c", "set /p input= && echo %input%"};
const PIStringList args = {"/c", "more"};
#else
const PIStringList args = {"-c", "read input; echo $input"};
#endif
@@ -73,7 +73,10 @@ TEST_F(ProcessTest, Input) {
EXPECT_TRUE(launcher.isExecStarted());
EXPECT_TRUE(!launcher.isExecFinished());
const PIString test_input = "Test input string\n";
PIString test_input = "Test input string\n";
#ifdef WINDOWS
test_input += (char)0x1A;
#endif
EXPECT_TRUE(launcher.writeInput(test_input.toAscii()));
launcher.closeInput();
@@ -91,5 +94,5 @@ TEST_F(ProcessTest, NonexistentCommand) {
launcher.exec(command);
ASSERT_TRUE(launcher.isRunning());
ASSERT_TRUE(launcher.waitForFinish());
EXPECT_FALSE(!launcher.isExecFinished());
EXPECT_FALSE(launcher.isExecFinished());
}