diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2020-04-06 16:20:29 +0200 |
---|---|---|
committer | Karen Arutyunov <karen@codesynthesis.com> | 2020-04-07 15:09:59 +0300 |
commit | 87d896f1107a077f3d1876f8feb9dcf9ee93ea3c (patch) | |
tree | 609b144f65d0a0f0db95ea031d7cbf6dafec5535 /libbuild2/cc/gcc.cxx | |
parent | e607800f687ba89fbdd97b2f1f1925217f00eb23 (diff) |
Pass LC_ALL=C when extracting locale-dependent information on POSIX
Diffstat (limited to 'libbuild2/cc/gcc.cxx')
-rw-r--r-- | libbuild2/cc/gcc.cxx | 41 |
1 files changed, 35 insertions, 6 deletions
diff --git a/libbuild2/cc/gcc.cxx b/libbuild2/cc/gcc.cxx index 84d4e01..29bf824 100644 --- a/libbuild2/cc/gcc.cxx +++ b/libbuild2/cc/gcc.cxx @@ -101,14 +101,35 @@ namespace build2 args.push_back ("-"); args.push_back (nullptr); + process_env env (xc); + + // For now let's assume that all the platforms other than Windows + // recognize LC_ALL. + // +#ifndef _WIN32 + const char* evars[] = {"LC_ALL=C", nullptr}; + env.vars = evars; +#endif + if (verb >= 3) - print_process (args); + print_process (env, args); try { + //@@ TODO: why don't we use run_start() here? Because it's unable to + // open pipe for stderr and we need to change it first, for example, + // making the err parameter a file descriptor rather than a flag. + // + // Open pipe to stderr, redirect stdin and stdout to /dev/null. // - process pr (xc, args.data (), -2, -2, -1); + process pr (xc, + args.data (), + -2, /* stdin */ + -2, /* stdout */ + -1, /* stderr */ + nullptr /* cwd */, + env.vars); try { @@ -237,12 +258,22 @@ namespace build2 args.push_back ("-print-search-dirs"); args.push_back (nullptr); + process_env env (xc); + + // For now let's assume that all the platforms other than Windows + // recognize LC_ALL. + // +#ifndef _WIN32 + const char* evars[] = {"LC_ALL=C", nullptr}; + env.vars = evars; +#endif + if (verb >= 3) - print_process (args); + print_process (env, args); // Open pipe to stdout. // - process pr (run_start (xc, + process pr (run_start (env, args, 0, /* stdin */ -1 /* stdout */)); @@ -316,7 +347,5 @@ namespace build2 return make_pair (move (r), rn); } - - } } |