diff options
Diffstat (limited to 'build2/test/script/script.cxx')
-rw-r--r-- | build2/test/script/script.cxx | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/build2/test/script/script.cxx b/build2/test/script/script.cxx index b128077..8fb8115 100644 --- a/build2/test/script/script.cxx +++ b/build2/test/script/script.cxx @@ -38,14 +38,16 @@ namespace build2 } // Quote if empty or contains spaces or any of the special characters. + // Note that we use single quotes since double quotes still allow + // expansion. // - // @@ What if it contains quotes, escapes? + // @@ What if it contains single quotes? // static void to_stream_q (ostream& o, const string& s) { - if (s.empty () || s.find_first_of (" |&<>=") != string::npos) - o << '"' << s << '"'; + if (s.empty () || s.find_first_of (" |&<>=\\\"") != string::npos) + o << '\'' << s << '\''; else o << s; }; @@ -100,7 +102,8 @@ namespace build2 // Add another '>' or '<'. Note that here end marker never // needs to be quoted. // - o << d << (nl ? "" : ":") << r.doc.end; + o << d << (nl ? "" : ":"); + to_stream_q (o, r.doc.end); break; } case redirect_type::file: |