summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--tests/osproc/texitcode.nim18
-rw-r--r--tests/osproc/tfalse.nim2
2 files changed, 20 insertions, 0 deletions
diff --git a/tests/osproc/texitcode.nim b/tests/osproc/texitcode.nim
new file mode 100644
index 000000000..df1db8aa3
--- /dev/null
+++ b/tests/osproc/texitcode.nim
@@ -0,0 +1,18 @@
+discard """
+  file: "texitcode.nim"
+  output: ""
+"""
+import osproc, os
+
+const filename = when defined(Windows): "tfalse.exe" else: "tfalse"
+
+doAssert fileExists(getCurrentDir() / "tests" / "osproc" / filename)
+
+var p = startProcess(filename, getCurrentDir() / "tests" / "osproc")
+doAssert(waitForExit(p) == QuitFailure)
+
+p = startProcess(filename, getCurrentDir() / "tests" / "osproc")
+var running = true
+while running:
+  running = running(p)
+doAssert(waitForExit(p) == QuitFailure)
diff --git a/tests/osproc/tfalse.nim b/tests/osproc/tfalse.nim
new file mode 100644
index 000000000..a2c5e259d
--- /dev/null
+++ b/tests/osproc/tfalse.nim
@@ -0,0 +1,2 @@
+import system
+quit(QuitFailure)