Skip to content

Commit f2899bc

Browse files
committed
fix: enlarge NewProcess's buffer #48
1 parent 225176f commit f2899bc

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

src/legacy/api/SystemAPI.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,15 +67,15 @@ bool NewProcess(
6767
WaitForSingleObject(hProcess, timeLimit);
6868
TerminateProcess(hProcess, -1);
6969
}
70-
char buffer[4096];
70+
char buffer[8192];
7171
string strOutput;
7272
DWORD bytesRead, exitCode;
7373

7474
delete[] wCmd;
7575
GetExitCodeProcess(hProcess, &exitCode);
7676
while (true) {
77-
ZeroMemory(buffer, 4096);
78-
if (!ReadFile(hRead, buffer, 4096, &bytesRead, nullptr)) break;
77+
ZeroMemory(buffer, 8192);
78+
if (!ReadFile(hRead, buffer, 8192, &bytesRead, nullptr)) break;
7979
strOutput.append(buffer, bytesRead);
8080
}
8181
CloseHandle(hRead);

src/legacy/legacyapi/utils/FileHelper.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,15 +60,15 @@ std::pair<int, std::string> NewProcessSync(const std::string& process, int timeL
6060
WaitForSingleObject(pi.hProcess, timeLimit);
6161
TerminateProcess(pi.hProcess, -1);
6262
}
63-
char buffer[4096];
63+
char buffer[8192];
6464
std::string strOutput;
6565
DWORD bytesRead, exitCode;
6666

6767
GetExitCodeProcess(pi.hProcess, &exitCode);
6868
if (!noReadOutput) {
6969
while (true) {
70-
ZeroMemory(buffer, 4096);
71-
if (!ReadFile(hRead, buffer, 4096, &bytesRead, nullptr)) break;
70+
ZeroMemory(buffer, 8192);
71+
if (!ReadFile(hRead, buffer, 8192, &bytesRead, nullptr)) break;
7272
strOutput.append(buffer, bytesRead);
7373
}
7474
}

0 commit comments

Comments
 (0)