summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorAndreas Rumpf <rumpf_a@web.de>2018-09-16 11:45:10 +0200
committerGitHub <noreply@github.com>2018-09-16 11:45:10 +0200
commit866d6d189119b12b70dfd62be9da1eefaf38d5ea (patch)
tree4288d88a6569fbb98aed0ec195717cc8c84ba211
parent501f6c80203c9dd8ca1bdf759f8850fb216e7755 (diff)
parent67aa8eab0b7f3c37c9c7936154ec567c8fdc1ec5 (diff)
downloadNim-866d6d189119b12b70dfd62be9da1eefaf38d5ea.tar.gz
Merge pull request #8897 from timotheecour/pr_startProcessAuxSpawn_raiseOSError_context
add data.sysCommand when startProcessAuxSpawn raises
-rw-r--r--lib/pure/includes/oserr.nim8
-rw-r--r--lib/pure/osproc.nim2
2 files changed, 5 insertions, 5 deletions
diff --git a/lib/pure/includes/oserr.nim b/lib/pure/includes/oserr.nim
index 493e8e174..31212d0d1 100644
--- a/lib/pure/includes/oserr.nim
+++ b/lib/pure/includes/oserr.nim
@@ -57,10 +57,10 @@ proc raiseOSError*(errorCode: OSErrorCode; additionalInfo = "") {.noinline.} =
   ## the message ``unknown OS error`` will be used.
   var e: ref OSError; new(e)
   e.errorCode = errorCode.int32
-  if additionalInfo.len == 0:
-    e.msg = osErrorMsg(errorCode)
-  else:
-    e.msg = osErrorMsg(errorCode) & "\nAdditional info: '" & additionalInfo & "'"
+  e.msg = osErrorMsg(errorCode)
+  if additionalInfo.len > 0:
+    e.msg.add  "; Additional info: "
+    e.msg.addQuoted additionalInfo
   if e.msg == "":
     e.msg = "unknown OS error"
   raise e
diff --git a/lib/pure/osproc.nim b/lib/pure/osproc.nim
index faeb01407..d7b734dda 100644
--- a/lib/pure/osproc.nim
+++ b/lib/pure/osproc.nim
@@ -902,7 +902,7 @@ elif not defined(useNimRtl):
 
       discard posix_spawn_file_actions_destroy(fops)
       discard posix_spawnattr_destroy(attr)
-      if res != 0'i32: raiseOSError(OSErrorCode(res))
+      if res != 0'i32: raiseOSError(OSErrorCode(res), data.sysCommand)
 
       return pid
   else: