Commit graph

269 commits

Author SHA1 Message Date
Sultan Al Isaiee
04a494f8cf
Add warning to specify timeout value in milliseconds, Fix #21449 (#21471)
a warning message been added to the documentation to remind users that the timeout parameter is expressed in milliseconds, not seconds. to help prevent confusion and unexpected behaviours.
2023-03-04 15:53:57 +01:00
tersec
612abda4f4
remove decades-deprecated Win32 API *A function support (#21315) 2023-03-02 05:51:54 +01:00
Andreas Rumpf
8a19ac2070
fixes #21393 and misc style changes (#21419)
* fixes #21393 and misc style changes

* progress

---------

Co-authored-by: ringabout <43030857+ringabout@users.noreply.github.com>
2023-02-24 09:02:15 +01:00
ringabout
56a4d246a4
Refines raises list in osproc (#21323)
* Remove Exception from raises in closeImpl

* Update osproc.nim

* refine errors

* add ValueError

* cast raises

* refactor raises lists

* Update lib/pure/osproc.nim

* Update lib/pure/osproc.nim

---------

Co-authored-by: Antonis Geralis <43617260+planetis-m@users.noreply.github.com>
Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
2023-02-14 13:11:14 +01:00
metagn
0b1650576c
move widestrs out of system (#20462)
* move widestrs out of system

* fix osproc
2022-10-01 22:35:09 +02:00
ee7
e8657c7107
make implicit cstring conversions explicit (#19488)
The Nim manual says that an implicit conversion to cstring will
eventually not be allowed [1]:

    A Nim `string` is implicitly convertible to `cstring` for convenience.

    [...]

    Even though the conversion is implicit, it is not *safe*: The garbage collector
    does not consider a `cstring` to be a root and may collect the underlying
    memory. For this reason, the implicit conversion will be removed in future
    releases of the Nim compiler. Certain idioms like conversion of a `const` string
    to `cstring` are safe and will remain to be allowed.

And from Nim 1.6.0, such a conversion triggers a warning [2]:

    A dangerous implicit conversion to `cstring` now triggers a `[CStringConv]` warning.
    This warning will become an error in future versions! Use an explicit conversion
    like `cstring(x)` in order to silence the warning.

However, some files in this repo produced such a warning. For example,
before this commit, compiling `parsejson.nim` would produce:

    /foo/Nim/lib/pure/parsejson.nim(221, 37) Warning: implicit conversion to 'cstring' from a non-const location: my.buf; this will become a compile time error in the future [CStringConv]
    /foo/Nim/lib/pure/parsejson.nim(231, 39) Warning: implicit conversion to 'cstring' from a non-const location: my.buf; this will become a compile time error in the future [CStringConv]

This commit resolves the most visible `CStringConv` warnings, making the
cstring conversions explicit.

[1] d2318d9ccf/doc/manual.md (cstring-type)
[2] d2318d9ccf/changelogs/changelog_1_6_0.md (type-system)
2022-08-19 15:40:53 -04:00
Daniel Clarke
01b40dc1d7
Fixes return values of execCmd on macos (#19963)
* Fixes return values of execCmd on macos

* update tests to use existing structure

Co-authored-by: daniel <danielclarke@wearepopgun.com>
2022-07-05 22:29:05 +02:00
Juan Carlos
b0bd4320a0
Remove deprecated typo poDemon (#19631)
* Remove Deprecated poDemon

* Remove Deprecated poDemon
2022-03-23 20:43:58 +01:00
flywind
7f6e800caf
move assertions out of system (#19599) 2022-03-23 20:34:53 +01:00
Dominic Ward
a8b5ad845c
Fix process lines iterator (#19605)
* Ensure lines when process done

* eliminate post-EOF exit test

* Recommend fixes for execCmdEx/execProcess
2022-03-23 07:50:36 +01:00
Andreas Rumpf
3241df2a13
fixes #18858 [backport] (#18868)
* fixes #18858 [backport]

* ensure async tests work with --experimental:strictEffects [backport]

* ensure async tests work with --experimental:strictEffects [backport]
2021-09-19 23:35:50 +02:00
Timothee Cour
78e2d299df
typo: nonexistant => nonexistent (#17918)
* typo: nonexistant => nonexistent

* fix test (ordering differs because of https://github.com/nim-lang/Nim/issues/17910)
2021-05-02 00:26:41 +02:00
konsumlamm
9819fb21d8
Use .. warning:: (#17320) 2021-03-10 10:39:23 -08:00
flywind
0e3ea16554
use lowercase --define switches (#17283) 2021-03-07 12:08:41 +01:00
Danil Yarantsev
56461c280f
Change stdlib imports to use std prefix in most examples (#17202) 2021-02-28 13:17:19 -08:00
Timothee Cour
31bb67a309
add -d:nimStrictMode in CI to keep code from regressing; fixes ConvFromXtoItselfNotNeeded, UnusedImport notes (#16764) 2021-02-17 19:30:09 +01:00
flywind
f140c92409
fix some warnings (#16952) 2021-02-08 13:50:15 +01:00
Juan Carlos
78a99587a4
Deprecate TaintedString (#15423)
Co-authored-by: Timothee Cour <timothee.cour2@gmail.com>
Co-authored-by: Dominik Picheta <dominikpicheta@googlemail.com>
2021-01-15 18:56:38 -08:00
n5m
b254d91cd0
reuse const (#16422) 2021-01-01 19:41:49 +01:00
n5m
5953fbd834
link to POSIX sendSignal from osproc.kill docs (#16475)
and from osproc.terminate docs
2021-01-01 19:01:45 +01:00
Tomohiro
dcdbae798c
Fix osproc so that it doesn't close pipe/process/thread handles twice (#16385) [backport]
* Add error check to closeHandle and fix closing handle twice in osproc

* Fix compile error on Linux
2020-12-18 10:17:19 +01:00
Elliot Waite
f3d57761ab
Fix broken links in docs (#16336)
* Fix broken links in docs

* Fix rand HSlice links
2020-12-14 20:13:12 +01:00
Araq
37758826ff typo 2020-10-06 06:33:43 +02: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
Tomohiro
c983466c15
Fix #14906 (#14949)
* Fix #14906 by wrapping outputStream with PipeOutStream

* Fix compile error when ./build_all.sh

* Use PipeOutStream on posix

* Fix compile error when build_all.sh

* Use ptr UncheckedArray

* Replace copyRefObj

* Remove tmp buffer from posPeekData

* Add more tests for outputStream

* Add comments about PipeOutStream.buffer

* Fix bug in posReadLine

* Move implementation of newPipeOutStream to streamwrapper module
2020-07-18 10:41:33 +02:00
narimiran
13193b2964 turn 'runnableExample' into 'code-block' to make nightlies green
This example doesn't work on our nightlies CI.
Other procs in this module already use 'code-block'.
2020-06-25 16:55:11 +02:00
Timothee Cour
041ee92bba
osproc.execCmdEx now takes an optional input for stdin, env, workingDir (#14211)
* `osproc.execCmdEx` now takes an optional `input` for stdin

* execCmdEx now also takes an optional ``workingDir` and `env`
2020-05-13 13:45:36 +02:00
Timothee Cour
d11cb9d495
fix a critical bug in windows.osproc leading to resource leaks and blocking IO [backport] (#14296) 2020-05-11 11:14:21 +02:00
slangmgh
b56432bd8a
fix #14203 (#14204) 2020-05-03 09:50:08 +02:00
Miran
9c33bcac5c
change 'iff' to 'if' to stop "corrections" once and for all (#14182) 2020-05-01 15:54:03 +02:00
alaviss
5f6962337d
osproc: added a better version of waitForExit for Haiku (#13938)
Also modified tosprocterminate to verify waitForExit implementations.
2020-04-10 09:34:52 +02:00
Juan Carlos
afd0afe0a3
Deprecate when declared(echo):echo (#13840) 2020-04-02 02:56:18 +02:00
Juan Carlos
4816984726
Documentation, add more examples (#13825) 2020-04-01 19:39:58 +02:00
alaviss
0eaacbc2c4
More fixes for Haiku (#13774)
* osproc: move fork-based code path under the when conditional

* osproc: avoid using the environ global on Haiku

* osenv: import environ from stdlib.h on Haiku

Haiku's environ is declared in `<stdlib.h>` by default, differing from
POSIX and/or Linux. Import it from there to avoid collision with anyone
importing `<stdlib.h>` from Nim.
2020-03-27 09:08:13 +01:00
Tomohiro
a33b72af49 Fix error check code in osproc (#13090) [backport] 2020-01-09 18:00:41 +01:00
Araq
3516947642 osproc: fixes regression 2019-12-24 17:33:27 +01:00
Araq
8f17a70fe1 ported osproc.nim to ARC 2019-12-24 17:33:27 +01:00
Andreas Rumpf
166048da5d osproc needs 'import linux' for -d:useClone 2019-11-07 09:51:15 +01:00
narimiran
cc3e9ca164 remove unused imports 2019-11-06 12:01:00 +01:00
Andreas Rumpf
60d64d1aef use system.move instead of system.shallowCopy if the GC mode requires it 2019-10-04 09:48:45 +02:00
narimiran
34d0be2ec1 [backport] run nimpretty on os-related stuff 2019-09-30 13:58:15 +02:00
Araq
c94647aeca styleCheck: make the compiler and large parts of the stdlib compatible with --styleCheck:error 2019-07-10 12:42:41 +02:00
Andreas Rumpf
02b9af2f75
ABI fixes for OSX/BSD; fixes #6860 (#11666) 2019-07-06 13:00:29 +02:00
Jasper Jenkins
91f0626dcb [bugfix] remove dangling ref (#11576) 2019-06-25 02:04:15 +02:00
Araq
9f5d9d1993 makes koch.nim sem'check with --newruntime 2019-04-06 19:13:10 +02:00
Araq
3b14f0ed10 see what appveyor thinks about this 2019-04-01 17:50:03 +02:00
Araq
c3067e36bb newruntime: progress 2019-04-01 16:51:18 +02:00
Anthon van der Neut
5661a8303c correct argument name, (#10813)
* correct argument name,

updated using poUsePath, based on feedback from c-blake

* Update osproc.nim

* explicit args parameter
2019-03-18 11:13:52 +01:00
narimiran
44d47134f9 Revert "Follow the documentation's recommendation (#10808)"
This reverts commit 1a13b3a14e.
2019-03-10 20:09:35 +01:00
Anthon van der Neut
1a13b3a14e Follow the documentation's recommendation (#10808)
The doc states "Make sure to pass options explicitly.", but the example didn't. 
Since constructing a string for the shell with appropriate quotes is non-trivial, the first example should be how to use `execProcess`  including `args`
2019-03-08 13:20:36 +01:00