summary refs log tree commit diff stats
path: root/tests/osproc
diff options
context:
space:
mode:
author握猫猫 <164346864@qq.com>2024-08-21 17:44:53 +0800
committerGitHub <noreply@github.com>2024-08-21 11:44:53 +0200
commit12b90d7c07c97772c833a80a84aa67f468ca8ac8 (patch)
tree6e84953f10e7d92725a5cb84869294542d188288 /tests/osproc
parente38cbd3c846a8e95bed0d709e4d61cc1ad5279b2 (diff)
downloadNim-12b90d7c07c97772c833a80a84aa67f468ca8ac8.tar.gz
Fixed an issue where `errorCode` was always 0 when `startProcess` did… (#23992)
…n't use the `poEvalCommand` flag

https://forum.nim-lang.org/t/12310

Added a test case, tested on my fedora system.
Diffstat (limited to 'tests/osproc')
-rw-r--r--tests/osproc/tnoexe.nim18
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/osproc/tnoexe.nim b/tests/osproc/tnoexe.nim
new file mode 100644
index 000000000..56edd0f87
--- /dev/null
+++ b/tests/osproc/tnoexe.nim
@@ -0,0 +1,18 @@
+discard """
+  output: '''true
+true'''
+"""
+
+import std/osproc
+
+const command = "lsaaa -lah"
+
+try:
+  let process = startProcess(command, options = {poUsePath})
+  discard process.waitForExit()
+except OSError as e:
+  echo e.errorCode != 0
+
+let process = startProcess(command, options = {poUsePath, poEvalCommand})
+let exitCode = process.waitForExit()
+echo exitCode != 0