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'.
This commit is contained in:
parent
0a9a639230
commit
13193b2964
1 changed files with 12 additions and 9 deletions
|
|
@ -1446,6 +1446,7 @@ proc execCmdEx*(command: string, options: set[ProcessOption] = {
|
||||||
## A convenience proc that runs the `command`, and returns its `output` and
|
## A convenience proc that runs the `command`, and returns its `output` and
|
||||||
## `exitCode`. `env` and `workingDir` params behave as for `startProcess`.
|
## `exitCode`. `env` and `workingDir` params behave as for `startProcess`.
|
||||||
## If `input.len > 0`, it is passed as stdin.
|
## If `input.len > 0`, it is passed as stdin.
|
||||||
|
##
|
||||||
## Note: this could block if `input.len` is greater than your OS's maximum
|
## Note: this could block if `input.len` is greater than your OS's maximum
|
||||||
## pipe buffer size.
|
## pipe buffer size.
|
||||||
##
|
##
|
||||||
|
|
@ -1456,15 +1457,17 @@ proc execCmdEx*(command: string, options: set[ProcessOption] = {
|
||||||
## * `execProcess proc
|
## * `execProcess proc
|
||||||
## <#execProcess,string,string,openArray[string],StringTableRef,set[ProcessOption]>`_
|
## <#execProcess,string,string,openArray[string],StringTableRef,set[ProcessOption]>`_
|
||||||
##
|
##
|
||||||
runnableExamples:
|
## Example:
|
||||||
var result = execCmdEx("nim r --hints:off -", options = {}, input = "echo 3*4")
|
##
|
||||||
import strutils, strtabs
|
## .. code-block:: Nim
|
||||||
stripLineEnd(result[0]) ## portable way to remove trailing newline, if any
|
## var result = execCmdEx("nim r --hints:off -", options = {}, input = "echo 3*4")
|
||||||
doAssert result == ("12", 0)
|
## import strutils, strtabs
|
||||||
doAssert execCmdEx("ls --nonexistant").exitCode != 0
|
## stripLineEnd(result[0]) ## portable way to remove trailing newline, if any
|
||||||
when defined(posix):
|
## doAssert result == ("12", 0)
|
||||||
assert execCmdEx("echo $FO", env = newStringTable({"FO": "B"})) == ("B\n", 0)
|
## doAssert execCmdEx("ls --nonexistant").exitCode != 0
|
||||||
assert execCmdEx("echo $PWD", workingDir = "/") == ("/\n", 0)
|
## when defined(posix):
|
||||||
|
## assert execCmdEx("echo $FO", env = newStringTable({"FO": "B"})) == ("B\n", 0)
|
||||||
|
## assert execCmdEx("echo $PWD", workingDir = "/") == ("/\n", 0)
|
||||||
|
|
||||||
when (NimMajor, NimMinor, NimPatch) < (1, 3, 5):
|
when (NimMajor, NimMinor, NimPatch) < (1, 3, 5):
|
||||||
doAssert input.len == 0
|
doAssert input.len == 0
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue