mirror of
https://github.com/dlang/phobos.git
synced 2025-05-13 15:52:41 +03:00
std.process: Fix escapePosixArgumentImpl
This commit is contained in:
parent
fc99e5583e
commit
96556b54f3
1 changed files with 5 additions and 2 deletions
|
@ -50,7 +50,7 @@ version (Posix)
|
||||||
version (unittest)
|
version (unittest)
|
||||||
{
|
{
|
||||||
import std.file, std.conv, std.array, std.random;
|
import std.file, std.conv, std.array, std.random;
|
||||||
import std.path : rel2abs;
|
import std.path : absolutePath;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -990,7 +990,10 @@ private char[] escapePosixArgumentImpl(alias allocator)(in char[] arg)
|
||||||
buf[p++] = '\'';
|
buf[p++] = '\'';
|
||||||
foreach (c; arg)
|
foreach (c; arg)
|
||||||
if (c == '\'')
|
if (c == '\'')
|
||||||
|
{
|
||||||
buf[p..p+4] = `'\''`;
|
buf[p..p+4] = `'\''`;
|
||||||
|
p += 4;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
buf[p++] = c;
|
buf[p++] = c;
|
||||||
buf[p++] = '\'';
|
buf[p++] = '\'';
|
||||||
|
@ -1138,7 +1141,7 @@ unittest
|
||||||
// Then, test this module with:
|
// Then, test this module with:
|
||||||
// rdmd --main -unittest -version=unittest_burnin process.d
|
// rdmd --main -unittest -version=unittest_burnin process.d
|
||||||
|
|
||||||
auto helper = rel2abs("std_process_unittest_helper");
|
auto helper = absolutePath("std_process_unittest_helper");
|
||||||
assert(shell(helper ~ " hello").split("\0")[1..$] == ["hello"], "Helper malfunction");
|
assert(shell(helper ~ " hello").split("\0")[1..$] == ["hello"], "Helper malfunction");
|
||||||
|
|
||||||
void test(string[] s, string fn)
|
void test(string[] s, string fn)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue