diff options
| author | Stefan Becker <stefanb@gpartner-nvidia.com> | 2016-04-07 13:28:42 +0300 |
|---|---|---|
| committer | Stefan Becker <stefanb@gpartner-nvidia.com> | 2016-04-12 12:31:46 +0300 |
| commit | 187bf08e7fc847da6dc8482383fa5c8364f0ac50 (patch) | |
| tree | 3ac5c8045bd10041c6636231a34912d932f87884 /ninja.cc | |
| parent | cd060c5ce8dc4128e3bf3dcbed57e36ef93486d5 (diff) | |
[C++] Add support for .POSIX:
Add a global flag that is set to "true" when .POSIX: is encountered. The
flag will switch the bash flags from "-c" to "-ec", i.e. enable correct
error handling of shell command lines.
Fixes https://github.com/google/kati/issues/48
Change-Id: Ieea386742b05b52d209b74e640e14212f0e2da88
Diffstat (limited to 'ninja.cc')
| -rw-r--r-- | ninja.cc | 4 |
1 files changed, 3 insertions, 1 deletions
@@ -185,6 +185,7 @@ class NinjaGenerator { default_target_(NULL) { ev_->set_avoid_io(true); shell_ = EscapeNinja(ev->EvalVar(kShellSym)); + shell_flags_ = g_flags.posix_shell ? "ec" : "c"; const string use_goma_str = ev->EvalVar(Intern("USE_GOMA")); use_goma_ = !(use_goma_str.empty() || use_goma_str == "false"); if (g_flags.goma_dir) @@ -501,7 +502,7 @@ class NinjaGenerator { *o << " command = " << shell_ << " $out.rsp\n"; } else { EscapeShell(&cmd_buf); - *o << " command = " << shell_ << " -c \"" << cmd_buf << "\"\n"; + *o << " command = " << shell_ << " -" << shell_flags_ << " \"" << cmd_buf << "\"\n"; } if (node->is_restat) { *o << " restat = 1\n"; @@ -769,6 +770,7 @@ class NinjaGenerator { bool use_goma_; string gomacc_; string shell_; + string shell_flags_; map<string, string> used_envs_; string kati_binary_; const double start_time_; |
