|
|
@@ -20,7 +20,7 @@ |
|
|
|
// Place, Suite 330, Boston, MA 02111-1307 USA
|
|
|
|
//==============================================================================
|
|
|
|
|
|
|
|
#ifndef WIN32
|
|
|
|
#ifndef _WIN32
|
|
|
|
#include <unistd.h>
|
|
|
|
#include <sys/types.h>
|
|
|
|
#include <sys/wait.h>
|
|
|
@@ -85,7 +85,7 @@ namespace CodeDweller { |
|
|
|
"run() was called");
|
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef WIN32
|
|
|
|
#ifdef _WIN32
|
|
|
|
// Set the bInheritHandle flag so pipe handles are inherited.
|
|
|
|
SECURITY_ATTRIBUTES securityAttributes;
|
|
|
|
|
|
|
@@ -325,7 +325,7 @@ namespace CodeDweller { |
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef WIN32
|
|
|
|
#ifdef _WIN32
|
|
|
|
if (!TerminateProcess(childProcess, terminateExitCode)) {
|
|
|
|
#else
|
|
|
|
if (kill(childPid, SIGTERM) != 0) {
|
|
|
@@ -352,7 +352,7 @@ namespace CodeDweller { |
|
|
|
|
|
|
|
int result;
|
|
|
|
|
|
|
|
#ifdef WIN32
|
|
|
|
#ifdef _WIN32
|
|
|
|
if (!GetExitCodeProcess(childProcess, (LPDWORD) &result)) {
|
|
|
|
throw std::runtime_error("Error checking status of child process: " +
|
|
|
|
getErrorText());
|
|
|
@@ -433,7 +433,7 @@ namespace CodeDweller { |
|
|
|
std::string
|
|
|
|
Child::getErrorText() {
|
|
|
|
|
|
|
|
#ifdef WIN32
|
|
|
|
#ifdef _WIN32
|
|
|
|
LPVOID winMsgBuf;
|
|
|
|
DWORD lastError = GetLastError();
|
|
|
|
|
|
|
@@ -457,7 +457,7 @@ namespace CodeDweller { |
|
|
|
}
|
|
|
|
|
|
|
|
Child::ReadStreambuf::ReadStreambuf(std::size_t bufferSize) :
|
|
|
|
#ifdef WIN32
|
|
|
|
#ifdef _WIN32
|
|
|
|
inputHandle(0),
|
|
|
|
#else
|
|
|
|
inputFileDescriptor(-1),
|
|
|
@@ -471,7 +471,7 @@ namespace CodeDweller { |
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef WIN32
|
|
|
|
#ifdef _WIN32
|
|
|
|
void
|
|
|
|
Child::ReadStreambuf::setInputHandle(HANDLE inHandle) {
|
|
|
|
|
|
|
@@ -511,7 +511,7 @@ namespace CodeDweller { |
|
|
|
}
|
|
|
|
|
|
|
|
// start points to the start of the buffer. Fill buffer.
|
|
|
|
#ifdef WIN32
|
|
|
|
#ifdef _WIN32
|
|
|
|
DWORD nBytesRead;
|
|
|
|
|
|
|
|
if (!ReadFile(inputHandle,
|
|
|
@@ -545,7 +545,7 @@ namespace CodeDweller { |
|
|
|
}
|
|
|
|
|
|
|
|
Child::WriteStreambuf::WriteStreambuf(std::size_t bufferSize) :
|
|
|
|
#ifdef WIN32
|
|
|
|
#ifdef _WIN32
|
|
|
|
outputHandle(0),
|
|
|
|
#else
|
|
|
|
outputFileDescriptor(-1),
|
|
|
@@ -559,7 +559,7 @@ namespace CodeDweller { |
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef WIN32
|
|
|
|
#ifdef _WIN32
|
|
|
|
void
|
|
|
|
Child::WriteStreambuf::setOutputHandle(HANDLE outHandle) {
|
|
|
|
|
|
|
@@ -581,7 +581,7 @@ namespace CodeDweller { |
|
|
|
// Write.
|
|
|
|
std::ptrdiff_t nBytes = pptr() - pbase();
|
|
|
|
|
|
|
|
#ifdef WIN32
|
|
|
|
#ifdef _WIN32
|
|
|
|
DWORD nBytesWritten;
|
|
|
|
|
|
|
|
if (!WriteFile(outputHandle,
|