Merge pull request #8897 from timotheecour/pr_startProcessAuxSpawn_raiseOSError_context

add data.sysCommand when startProcessAuxSpawn raises
This commit is contained in:
Andreas Rumpf 2018-09-16 11:45:10 +02:00 • committed by GitHub
commit 866d6d1891
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 5 deletions

View file

@ -57,10 +57,10 @@ proc raiseOSError*(errorCode: OSErrorCode; additionalInfo = "") {.noinline.} =
## the message ``unknown OS error`` will be used. ## the message ``unknown OS error`` will be used.
var e: ref OSError; new(e) var e: ref OSError; new(e)
e.errorCode = errorCode.int32 e.errorCode = errorCode.int32
if additionalInfo.len == 0: e.msg = osErrorMsg(errorCode)
e.msg = osErrorMsg(errorCode) if additionalInfo.len > 0:
else: e.msg.add "; Additional info: "
e.msg = osErrorMsg(errorCode) & "\nAdditional info: '" & additionalInfo & "'" e.msg.addQuoted additionalInfo
if e.msg == "": if e.msg == "":
e.msg = "unknown OS error" e.msg = "unknown OS error"
raise e raise e

View file

@ -902,7 +902,7 @@ elif not defined(useNimRtl):
discard posix_spawn_file_actions_destroy(fops) discard posix_spawn_file_actions_destroy(fops)
discard posix_spawnattr_destroy(attr) discard posix_spawnattr_destroy(attr)
if res != 0'i32: raiseOSError(OSErrorCode(res)) if res != 0'i32: raiseOSError(OSErrorCode(res), data.sysCommand)
return pid return pid
else: else: