From b0307e8323cb64b4fd44a4fc96f4a1f5581dfe2e Mon Sep 17 00:00:00 2001 From: "andrey.bychkov" Date: Wed, 5 Aug 2026 12:01:36 +0300 Subject: [PATCH] fix piprocess set workdir --- libs/main/system/piprocess.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/libs/main/system/piprocess.cpp b/libs/main/system/piprocess.cpp index aa4c4713..ffa6a871 100644 --- a/libs/main/system/piprocess.cpp +++ b/libs/main/system/piprocess.cpp @@ -215,10 +215,10 @@ PRIVATE_DEFINITION_START(PIProcess) PeekNamedPipe(pipes[pipe_type][PipeRead], nullptr, 0, nullptr, &available, nullptr); if (available > 0) { BOOL ok = ReadFile(pipes[pipe_type][PipeRead], - read_buffer.data(offset), - piMini(available, read_buffer.size() - offset), - &bytes_read, - nullptr); + read_buffer.data(offset), + piMini(available, read_buffer.size() - offset), + &bytes_read, + nullptr); if (!ok) bytes_read = 0; } # else @@ -293,10 +293,10 @@ void PIProcess::startProc(bool detached) { si.dwFlags |= STARTF_USESTDHANDLES; const auto cmd = convertWindowsCmd(args); if (CreateProcessA(0, // No module name (use command line) - (LPSTR)cmd.data(), // Command line + (LPSTR)cmd.data(), // Command line 0, // Process handle not inheritable 0, // Thread handle not inheritable - true, // Set handle inheritance to FALSE + true, // Set handle inheritance to FALSE detached ? DETACHED_PROCESS /*CREATE_NEW_CONSOLE*/ : 0, // Creation flags 0, // Use environment wd.isEmpty() ? 0 : wd.data(), // Use working directory @@ -322,7 +322,7 @@ void PIProcess::startProc(bool detached) { if (!detached) PRIVATE->pid = pid_; if (pid_ == 0) { if (!wd.isEmpty()) { - if (!chdir(wd.data())) piCoutObj << "Error while set working directory"; + if (chdir(wd.data()) != 0) piCoutObj << "Error while set working directory"; } PRIVATE->closePipe(StdIn, PipeWrite); PRIVATE->closePipe(StdOut, PipeRead);