blob: d07a2120a8d25b90e1138c07299abde6ae401022 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
|
// file : libbutl/process-io.mxx -*- C++ -*-
// license : MIT; see accompanying LICENSE file
#ifndef __cpp_modules_ts
#pragma once
#endif
// C includes.
#ifndef __cpp_lib_modules_ts
#include <ostream>
#endif
// Other includes.
#ifdef __cpp_modules_ts
export module butl.process_io;
#ifdef __cpp_lib_modules_ts
import std.core; //@@ MOD TMP (should not be needed).
import std.io;
#endif
import butl.process;
#else
#include <libbutl/process.mxx>
#endif
#include <libbutl/export.hxx>
LIBBUTL_MODEXPORT namespace butl
{
inline std::ostream&
operator<< (std::ostream& o, const process_path& p)
{
return o << p.recall_string ();
}
inline std::ostream&
operator<< (std::ostream& o, const process_args& a)
{
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&);
}
|