@@ -16,11 +16,11 @@ #include "config.h" #include #include -#import "OFProcess.h" +#import "OFSubprocess.h" #import "OFArray.h" #import "OFData.h" #import "OFDictionary.h" #import "OFLocale.h" #import "OFString.h" @@ -32,41 +32,41 @@ #import "OFReadFailedException.h" #import "OFWriteFailedException.h" #include -@interface OFProcess () +@interface OFSubprocess () - (of_char16_t *)of_wideEnvironmentForDictionary: (OFDictionary *)dictionary; - (char *)of_environmentForDictionary: (OFDictionary *)environment; @end -@implementation OFProcess -+ (instancetype)processWithProgram: (OFString *)program +@implementation OFSubprocess ++ (instancetype)subprocessWithProgram: (OFString *)program { return [[[self alloc] initWithProgram: program] autorelease]; } -+ (instancetype)processWithProgram: (OFString *)program - arguments: (OFArray *)arguments ++ (instancetype)subprocessWithProgram: (OFString *)program + arguments: (OFArray *)arguments { return [[[self alloc] initWithProgram: program arguments: arguments] autorelease]; } -+ (instancetype)processWithProgram: (OFString *)program - programName: (OFString *)programName - arguments: (OFArray *)arguments ++ (instancetype)subprocessWithProgram: (OFString *)program + programName: (OFString *)programName + arguments: (OFArray *)arguments { return [[[self alloc] initWithProgram: program programName: programName arguments: arguments] autorelease]; } -+ (instancetype)processWithProgram: (OFString *)program - programName: (OFString *)programName - arguments: (OFArray *)arguments - environment: (OFDictionary *)environment ++ (instancetype)subprocessWithProgram: (OFString *)program + programName: (OFString *)programName + arguments: (OFArray *)arguments + environment: (OFDictionary *)environment { return [[[self alloc] initWithProgram: program programName: programName arguments: arguments environment: environment] autorelease]; @@ -115,11 +115,11 @@ SECURITY_ATTRIBUTES sa; PROCESS_INFORMATION pi; void *pool; OFMutableString *argumentsString; - _process = INVALID_HANDLE_VALUE; + _handle = INVALID_HANDLE_VALUE; _readPipe[0] = _writePipe[1] = NULL; sa.nLength = sizeof(sa); sa.bInheritHandle = TRUE; sa.lpSecurityDescriptor = NULL; @@ -228,11 +228,11 @@ exceptionWithClass: self.class]; } objc_autoreleasePoolPop(pool); - _process = pi.hProcess; + _handle = pi.hProcess; CloseHandle(pi.hThread); CloseHandle(_readPipe[1]); CloseHandle(_writePipe[0]); } @catch (id e) { @@ -382,16 +382,16 @@ @throw [OFNotOpenException exceptionWithObject: self]; [self closeForWriting]; CloseHandle(_readPipe[0]); - if (_process != INVALID_HANDLE_VALUE) { - TerminateProcess(_process, 0); - CloseHandle(_process); + if (_handle != INVALID_HANDLE_VALUE) { + TerminateProcess(_handle, 0); + CloseHandle(_handle); } - _process = INVALID_HANDLE_VALUE; + _handle = INVALID_HANDLE_VALUE; _readPipe[0] = NULL; [super close]; } @@ -398,22 +398,22 @@ - (int)waitForTermination { if (_readPipe[0] == NULL) @throw [OFNotOpenException exceptionWithObject: self]; - if (_process != INVALID_HANDLE_VALUE) { + if (_handle != INVALID_HANDLE_VALUE) { DWORD exitCode; - WaitForSingleObject(_process, INFINITE); + WaitForSingleObject(_handle, INFINITE); - if (GetExitCodeProcess(_process, &exitCode)) + if (GetExitCodeProcess(_handle, &exitCode)) _status = exitCode; else _status = GetLastError(); - CloseHandle(_process); - _process = INVALID_HANDLE_VALUE; + CloseHandle(_handle); + _handle = INVALID_HANDLE_VALUE; } return _status; } @end