hammerlab / genspio

Generate Shell Phrases In OCaml
https://smondet.gitlab.io/genspio-doc/
Apache License 2.0
48 stars 3 forks source link

Hidding subshells can lead to surprising behavior #43

Open smondet opened 7 years ago

smondet commented 7 years ago

We use subshells ($( ... ) and ( ... )) in a few places, and those behave like sub-processes wrt execution environment.

let cmd_wrapper c = (* wraps c with redirections *) in

....
cmd_wrapper "cd /tmp";
cmd_wrapper "pwd";  (* <- this is not in /tmp because the cmd_wrapper made a subshell that cancels the "cd" when finishing. *)
....

How do/we document/warn about that?