Skip to content

Commit 9799317

Browse files
author
Daniel Kroening
authored
Merge pull request #5269 from diffblue/empty-arg-on-windows
on Windows, empty command-line arguments require quotes
2 parents f34e4f2 + 9e86cd0 commit 9799317

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/util/run.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,8 @@ static fdt stdio_redirection(int fd, const std::string &file)
165165
// https://blogs.msdn.microsoft.com/twistylittlepassagesallalike/2011/04/23/everyone-quotes-command-line-arguments-the-wrong-way/
166166
std::wstring quote_windows_arg(const std::wstring &src)
167167
{
168-
if(src.find_first_of(L" \t\n\v\"") == src.npos)
168+
// note that an empty argument requires quotes
169+
if(src.find_first_of(L" \t\n\v\"") == src.npos && !src.empty())
169170
return src;
170171

171172
std::wstring result = L"\"";

0 commit comments

Comments
 (0)