aboutsummaryrefslogtreecommitdiff
path: root/func.cc
diff options
context:
space:
mode:
authorDan Willemsen <dwillemsen@google.com>2015-08-21 11:13:28 -0700
committerDan Willemsen <dwillemsen@google.com>2015-08-25 13:25:21 -0700
commite6f6858860e28b4336ae5d64d42b5080a6fbe4c1 (patch)
tree9a6f05480920bd82fd412ecd2e122b7f59994389 /func.cc
parentfcd7a98b3008c518a063140530366fc1ef57c0f1 (diff)
downloadkati-e6f6858860e28b4336ae5d64d42b5080a6fbe4c1.tar.gz
[C++] Fix newlines in $(info/warning/error)
Change-Id: Ia20a1ef563a6871ed843b9388fe27e87b8bd7020
Diffstat (limited to 'func.cc')
-rw-r--r--func.cc8
1 files changed, 4 insertions, 4 deletions
diff --git a/func.cc b/func.cc
index 39d5c77..2ca117c 100644
--- a/func.cc
+++ b/func.cc
@@ -622,7 +622,7 @@ void FlavorFunc(const vector<Value*>& args, Evaluator* ev, string* s) {
void InfoFunc(const vector<Value*>& args, Evaluator* ev, string*) {
const string&& a = args[0]->Eval(ev);
if (ev->avoid_io()) {
- ev->add_delayed_output_command(StringPrintf("echo '%s'", a.c_str()));
+ ev->add_delayed_output_command(StringPrintf("echo -e \"%s\"", EchoEscape(a).c_str()));
return;
}
printf("%s\n", a.c_str());
@@ -633,7 +633,7 @@ void WarningFunc(const vector<Value*>& args, Evaluator* ev, string*) {
const string&& a = args[0]->Eval(ev);
if (ev->avoid_io()) {
ev->add_delayed_output_command(
- StringPrintf("echo '%s:%d: %s' 2>&1", LOCF(ev->loc()), a.c_str()));
+ StringPrintf("echo -e \"%s:%d: %s\" 2>&1", LOCF(ev->loc()), EchoEscape(a).c_str()));
return;
}
printf("%s:%d: %s\n", LOCF(ev->loc()), a.c_str());
@@ -644,8 +644,8 @@ void ErrorFunc(const vector<Value*>& args, Evaluator* ev, string*) {
const string&& a = args[0]->Eval(ev);
if (ev->avoid_io()) {
ev->add_delayed_output_command(
- StringPrintf("echo '%s:%d: *** %s.' 2>&1 && false",
- LOCF(ev->loc()), a.c_str()));
+ StringPrintf("echo -e \"%s:%d: *** %s.\" 2>&1 && false",
+ LOCF(ev->loc()), EchoEscape(a).c_str()));
return;
}
ev->Error(StringPrintf("*** %s.", a.c_str()));