diff options
author | Simon Hafner <hafnersimon@gmail.com> | 2014-04-16 18:44:26 -0500 |
---|---|---|
committer | Simon Hafner <hafnersimon@gmail.com> | 2014-04-16 18:44:26 -0500 |
commit | 6886a4730569904c4f4a63a2432664c4395af581 (patch) | |
tree | d4dc9252d231d2a420b1e93d66a84f1c98385789 | |
parent | 208ef2970680efde97caebb3b34cb2b14ae5b879 (diff) | |
parent | de04c976961f8e4f63663a8e2d36d7408a270ea5 (diff) | |
download | Nim-6886a4730569904c4f4a63a2432664c4395af581.tar.gz |
Merge pull request #1102 from gradha/pr_improves_startProcess_docstring
Improves startProcess docstring for poEvalCommand usage.
-rw-r--r-- | lib/pure/osproc.nim | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/lib/pure/osproc.nim b/lib/pure/osproc.nim index 5d6848565..ed83507d4 100644 --- a/lib/pure/osproc.nim +++ b/lib/pure/osproc.nim @@ -137,6 +137,14 @@ proc startProcess*(command: string, ## to `startProcess`. See the documentation of ``TProcessOption`` for the ## meaning of these flags. You need to `close` the process when done. ## + ## Note that you can't pass any `args` if you use the option + ## ``poEvalCommand``, which invokes the system shell to run the specified + ## `command`. In this situation you have to concatenate manually the contents + ## of `args` to `command` carefully escaping/quoting any special characters, + ## since it will be passed *as is* to the system shell. Each system/shell may + ## feature different escaping rules, so try to avoid this kind of shell + ## invokation if possible as it leads to non portable software. + ## ## Return value: The newly created process object. Nil is never returned, ## but ``EOS`` is raised in case of an error. @@ -633,7 +641,7 @@ elif not defined(useNimRtl): if poEvalCommand in options: sysCommand = "/bin/sh" sysArgsRaw = @[sysCommand, "-c", command] - assert args.len == 0 + assert args.len == 0, "`args` has to be empty when using poEvalCommand." else: sysCommand = command sysArgsRaw = @[command] |