summary refs log tree commit diff stats
path: root/lib
diff options
context:
space:
mode:
authorGrzegorz Adam Hankiewicz <gradha@imap.cc>2014-04-16 23:14:13 +0200
committerGrzegorz Adam Hankiewicz <gradha@imap.cc>2014-04-16 23:14:13 +0200
commitde04c976961f8e4f63663a8e2d36d7408a270ea5 (patch)
treed4dc9252d231d2a420b1e93d66a84f1c98385789 /lib
parent2fb5d62927b217b070fec3657abe1b132a53b91a (diff)
downloadNim-de04c976961f8e4f63663a8e2d36d7408a270ea5.tar.gz
Improves startProcess docstring for poEvalCommand usage.
Diffstat (limited to 'lib')
-rw-r--r--lib/pure/osproc.nim10
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]