Improves osproc.startProcess error message. Fixes #2183.

This commit is contained in:
Dominik Picheta
2015-08-23 21:57:45 +01:00
parent fe190ee83f
commit 1b73cd41bf

View File

@@ -468,7 +468,14 @@ when defined(Windows) and not defined(useNimRtl):
fileClose(si.hStdError)
if e != nil: dealloc(e)
if success == 0: raiseOSError(lastError, command)
if success == 0:
const errInvalidParameter = 87.int
const errFileNotFound = 2.int
if lastError.int in {errInvalidParameter, errFileNotFound}:
raiseOSError(lastError,
"Requested command not found: '$1'. OS error:" % command)
else:
raiseOSError(lastError, command)
# Close the handle now so anyone waiting is woken:
discard closeHandle(procInfo.hThread)
result.fProcessHandle = procInfo.hProcess