PIProcess code brush
This commit is contained in:
@@ -211,14 +211,14 @@ PRIVATE_DEFINITION_START(PIProcess)
|
|||||||
while (1) {
|
while (1) {
|
||||||
# ifdef WINDOWS
|
# ifdef WINDOWS
|
||||||
DWORD available = 0;
|
DWORD available = 0;
|
||||||
bytes_read = 0;
|
bytes_read = 0;
|
||||||
PeekNamedPipe(pipes[pipe_type][PipeRead], nullptr, 0, nullptr, &available, nullptr);
|
PeekNamedPipe(pipes[pipe_type][PipeRead], nullptr, 0, nullptr, &available, nullptr);
|
||||||
if (available > 0) {
|
if (available > 0) {
|
||||||
BOOL ok = ReadFile(pipes[pipe_type][PipeRead],
|
BOOL ok = ReadFile(pipes[pipe_type][PipeRead],
|
||||||
read_buffer.data(offset),
|
read_buffer.data(offset),
|
||||||
piMini(available, read_buffer.size() - offset),
|
piMini(available, read_buffer.size() - offset),
|
||||||
&bytes_read,
|
&bytes_read,
|
||||||
nullptr);
|
nullptr);
|
||||||
if (!ok) bytes_read = 0;
|
if (!ok) bytes_read = 0;
|
||||||
}
|
}
|
||||||
# else
|
# else
|
||||||
@@ -244,7 +244,7 @@ PRIVATE_DEFINITION_START(PIProcess)
|
|||||||
# else
|
# else
|
||||||
sz = ::write(pipes[StdIn][PipeWrite], data.data(), data.size());
|
sz = ::write(pipes[StdIn][PipeWrite], data.data(), data.size());
|
||||||
# endif
|
# endif
|
||||||
return sz == data.size_s();
|
return sz == (SizeType)data.size_s();
|
||||||
}
|
}
|
||||||
|
|
||||||
PRIVATE_DEFINITION_END(PIProcess)
|
PRIVATE_DEFINITION_END(PIProcess)
|
||||||
@@ -354,7 +354,7 @@ void PIProcess::startProc(bool detached) {
|
|||||||
if (WIFEXITED(exit_code)) {
|
if (WIFEXITED(exit_code)) {
|
||||||
exec_finished = WEXITSTATUS(exit_code) != 127;
|
exec_finished = WEXITSTATUS(exit_code) != 127;
|
||||||
}
|
}
|
||||||
pid_ = 0;
|
pid_ = 0;
|
||||||
if (!detached) PRIVATE->pid = pid_;
|
if (!detached) PRIVATE->pid = pid_;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user