summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorringabout <43030857+ringabout@users.noreply.github.com>2024-08-21 20:53:38 +0800
committerGitHub <noreply@github.com>2024-08-21 20:53:38 +0800
commit832ba815d1cf7ec0846cdade49f697228bb04d22 (patch)
treeb556b87bbf9fcec4ee94b96d3ca08dc0f709564b /lib
parent12b90d7c07c97772c833a80a84aa67f468ca8ac8 (diff)
downloadNim-832ba815d1cf7ec0846cdade49f697228bb04d22.tar.gz
Revert "Fixed an issue where `errorCode` was always 0 when `startProcess` did…" (#23995)
Reverts nim-lang/Nim#23992
Diffstat (limited to 'lib')
-rw-r--r--lib/pure/osproc.nim11
1 files changed, 4 insertions, 7 deletions
diff --git a/lib/pure/osproc.nim b/lib/pure/osproc.nim
index c304ecca6..bd6bcde2b 100644
--- a/lib/pure/osproc.nim
+++ b/lib/pure/osproc.nim
@@ -1123,13 +1123,14 @@ elif not defined(useNimRtl):
var error: cint
let sizeRead = read(data.pErrorPipe[readIdx], addr error, sizeof(error))
if sizeRead == sizeof(error):
- raiseOSError(OSErrorCode(error),
+ raiseOSError(osLastError(),
"Could not find command: '" & $data.sysCommand & "'. OS error: " & $strerror(error))
return pid
{.push stacktrace: off, profiler: off.}
- proc startProcessFail(data: ptr StartProcessData, error: cint = errno) =
+ proc startProcessFail(data: ptr StartProcessData) =
+ var error: cint = errno
discard write(data.pErrorPipe[writeIdx], addr error, sizeof(error))
exitnow(1)
@@ -1166,11 +1167,7 @@ elif not defined(useNimRtl):
if (poUsePath in data.options):
when defined(uClibc) or defined(linux) or defined(haiku):
# uClibc environment (OpenWrt included) doesn't have the full execvpe
- var exe: string
- try:
- exe = findExe(data.sysCommand)
- except OSError as e:
- startProcessFail(data, e.errorCode)
+ let exe = findExe(data.sysCommand)
discard execve(exe.cstring, data.sysArgs, data.sysEnv)
else:
# MacOSX doesn't have execvpe, so we need workaround.