aboutsummaryrefslogtreecommitdiff
path: root/libbutl/process-io.mxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2020-04-06 16:19:38 +0200
committerKaren Arutyunov <karen@codesynthesis.com>2020-04-07 15:08:30 +0300
commitca0fa738650ab546b1422e0b2dbfdc89ba8eb5a3 (patch)
tree5e9fe6a4d8b419ab8fd94cc0614d76d2a7376028 /libbutl/process-io.mxx
parent5fba51e990e7111c7dc125c1115ac7b5de4025be (diff)
Add ability to print process_env environment
Diffstat (limited to 'libbutl/process-io.mxx')
-rw-r--r--libbutl/process-io.mxx24
1 files changed, 24 insertions, 0 deletions
diff --git a/libbutl/process-io.mxx b/libbutl/process-io.mxx
index 5471846..d07a212 100644
--- a/libbutl/process-io.mxx
+++ b/libbutl/process-io.mxx
@@ -40,4 +40,28 @@ LIBBUTL_MODEXPORT namespace butl
process::print (o, a.argv, a.argc);
return o;
}
+
+ // Print the environment variables and the current working directory (if
+ // specified) in a POSIX shell command line notation. The process path
+ // itself is not printed. For example:
+ //
+ // LC_ALL=C
+ //
+ // If an environment variable is in the `name` rather than in the
+ // `name=value` form, then it is considered unset. Since there is no POSIX
+ // way to unset a variable on the command line, this information is printed
+ // as `name=` (ambiguous with assigning an empty value but the two cases are
+ // normally handled in the same way). For example:
+ //
+ // PATH= LC_ALL=C
+ //
+ // Note that since there is no POSIX way to change the current working
+ // directory of a command to be executed, this information is printed in a
+ // pseudo-notation by assigning to PWD (which, according POSIX, would result
+ // in the undefined behavior of the cwd utility). For example:
+ //
+ // PWD=/tmp LC_ALL=C
+ //
+ LIBBUTL_SYMEXPORT std::ostream&
+ operator<< (std::ostream&, const process_env&);
}