35 Commits

Author SHA1 Message Date
握猫猫
5e8cd318ef Fix linux start process errorCode always 0 (#24001)
#23992 The test case provided does not cover the Windows situation, I
fixed it in this new PR.

Fixed an issue where errorCode was always 0 when startProcess didn't use
the poEvalCommand flag.

Tthe sleep command might not be available in all Windows installations,
so I skipped the relevant test.

Added a test case, tested on my fedora and windows systems.
2024-08-28 20:52:00 +02:00
ringabout
832ba815d1 Revert "Fixed an issue where errorCode was always 0 when startProcess did…" (#23995)
Reverts nim-lang/Nim#23992
2024-08-21 20:53:38 +08:00
握猫猫
12b90d7c07 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.
2024-08-21 11:44:53 +02:00
Mark Leyva
58b36bd85e fixes #23825; Busy wait on waitid, sleeping at regular intervals (#23826)
Addresses #23825 by using the approaching described in
https://github.com/nim-lang/Nim/pull/23743#issuecomment-2199523110.

This takes the approach from Python's `subprocess` library which calls
`waitid` in loop, while sleeping at regular intervals.

CC @alex65536
2024-07-12 15:25:18 +02:00
Mark Leyva
288d5c4ac3 fixes #5091; Ensure we don't wait on an exited process on Linux (#23743)
Fixes #5091.

Ensure we don't wait on an exited process on Linux
2024-07-01 11:42:11 +02:00
Andreas Rumpf
06232b7f2e fixes #18058 (#18162) 2021-06-03 17:12:45 +02:00
Timothee Cour
3b1aabdcff change --hint[X] => --hint:X in nim repo (avoids shell quoting issues) (#18085) 2021-05-26 09:51:48 +02:00
Timothee Cour
87229e272e fix #17853 (ascii message separator broke json nim dump) (#17887) 2021-04-29 02:25:08 -07:00
Andreas Rumpf
0b116310bf unit separator (#17730)
* use the ASCII Unit Separator so that error messages can be handled precisely by the tooling
* updated testament
2021-04-20 16:30:17 +02:00
flywind
6d442a40a6 use doAssert in tests (#16486) 2020-12-28 14:13:21 +01:00
Timothee Cour
96930b9cae targets: use cpp instead of c++ everywhere (was by far the most common) (#15961) 2020-11-14 10:08:15 +01:00
c-blake
26d656e73e Add first draft of new osproc.readLines (#15429)
* Add first draft of new osproc.readLines

* Add test for new osproc.readLines

* Rename test to start w/t to run; Also add newline to output

* Suppress hint messages.

* Output should match this time.

* Shoulda picked a program with simpler syntax than ..lol

* Address https://github.com/nim-lang/Nim/pull/15429#issuecomment-701890898
and https://github.com/nim-lang/Nim/pull/15429#issuecomment-701985976 by
factoring `readLines` into `iterator lines` and a wrapper `proc`.

* Address https://github.com/nim-lang/Nim/pull/15429#issuecomment-702127289
and also add a `ReadIOEffect` tag to the iterator (called by the wrapper..
so it should need no separate tag, if I understand correctly).
2020-10-01 18:06:38 +02:00
Timothee Cour
90808877c5 testament: generic N-fold batching: windows CI 37mn=>16m (#14823)
* testament: run CI faster thanks to batching
* move ta_in, tstdin into existing tosproc
* move ta_out,tafalse,texitcode,tstderr into existing tosproc
* joinable osproc
* move tstdout into existing tosproc
* spec: batchable; fix tests
* fixup
2020-06-27 16:51:17 +02:00
Timothee Cour
db540a0223 fix #13449 texitcode flaky on windows (#13487) 2020-02-25 17:49:16 +01:00
Araq
f18fcf65b3 make tests green again 2018-12-11 21:23:26 +01:00
Arne Döring
a5ecbf823f lots of small changes 2018-12-11 21:23:22 +01:00
Arne Döring
1105d03644 require errormsg to be specified before file. 2018-12-11 21:23:21 +01:00
Arne Döring
534601637a more tests fixed 2018-11-23 11:58:29 +01:00
Arne Döring
9c2365d5c2 activated more tests, allow input in test spec 2018-11-23 11:58:28 +01:00
Araq
bacf08e65d merged #8624 manually; fixes #8442; closes #8575 2018-08-31 11:19:42 +02:00
alaviss
7ef268274f Haiku support for Nim (#8542)
* posix_other: Haiku now has spawn.h

This is added per https://dev.haiku-os.org/ticket/13446

* posix_other: Add Haiku specific Dirent members

* cpuinfo: Add an implementation for Haiku

* distros: Add basic Haiku support

* encodings: update Haiku support

* fenv, math: Haiku now provides libm

* times: Add Haiku struct members

* ansi_c, osalloc: Add Haiku constants

* threads: Add Haiku support

* testament: Haiku uses LIBRARY_PATH

* nim.cfg: Update Haiku support

libnetwork should only be linked if network functions are used

* threads: Haiku does not support -pthread switch

* tworkingdir: Haiku's env is in /bin

* posix_other: add SIGKILLTHR for Haiku

* sockets: link with libnetwork on Haiku

* coro: correct ucontext.h location

http://pubs.opengroup.org/onlinepubs/009696699/basedefs/ucontext.h.html

* coro: ucontext backend is not available on Haiku

Haiku doesn't provide the <ucontext.h> header, as it was removed from POSIX

* coro: fix setjmp backend

The compiler does not allow statements after a noreturn function

* nativesockets: Haiku doesn't support AI_V4MAPPED

* system: hostOS can contains "haiku"

* os: add support for Haiku's packagefs

packagefs is read-only, but there are writable holes to the underlying
file system as well

* os: update constant for Haiku
2018-08-14 09:35:07 +02:00
Michał Zieliński
b2060acbc4 osproc: fix double close on POSIX (#5724)
Calling close() in some cases issued two close() syscalls to one FD, which is incorrect in multithreaded programs.
2018-04-16 20:02:26 +02:00
Dmitry Atamanov
cf6d41b51d Fixes #5281 (#7489) 2018-04-06 10:09:05 +02:00
cheatfate
c6c0d28a4f Refactored version of execProcesses with test. 2017-11-28 14:03:09 +02:00
Fredrik Høisæther Rasch
c39e202976 Introduce first class support for Android (#5772) 2017-08-06 02:18:15 +02:00
Jacek Sieka
0055729755 WIFSIGNALED means process has exited too (with a bang!) (#5678) 2017-04-27 21:39:32 +02:00
Fabian Keller
e8ad59fdc4 Bugfix/double newlines in stderr (#5426) 2017-02-24 09:48:38 +01:00
Johannes Hofmann
95188edf6f make sure first call to running() after process exit returns false 2016-12-03 14:07:08 +01:00
cheatfate
0c69891b8d One more attempt to fix #4867 2016-10-21 11:15:33 +03:00
Johannes Hofmann
7f25db2dd1 rename tfalse.nim to tafalse.nim 2016-09-30 10:39:57 +02:00
Johannes Hofmann
8d85809d62 add testcase for exit code handling 2016-09-30 10:27:59 +02:00
Dmitry Polienko
5f773bf478 Fix passing environment in startProcess (win)
Previous implementation used newWideCString, which doesn't
handle strings with \0 characters.
2016-07-18 23:28:40 -07:00
Adam Strzelecki
e80465dacf tests: Trim .nim files trailing whitespace
via OSX: find . -name '*.nim' -exec sed -i '' -E 's/[[:space:]]+$//' {} +
2015-09-04 23:04:32 +02:00
def
1c4153790b Clean up tests/osproc 2015-02-04 22:15:30 +01:00
Dominik Picheta
8965ee5984 Add osproc stdin test. 2014-06-15 12:57:05 +01:00