diff options
| author | Andrew Kelley <superjoe30@gmail.com> | 2018-05-13 13:38:03 -0400 |
|---|---|---|
| committer | Andrew Kelley <superjoe30@gmail.com> | 2018-05-13 13:38:03 -0400 |
| commit | 86a352c45bb654951529660b2e6cbbfa72773170 (patch) | |
| tree | e7a4f5760918ec54bf247e9c23dc7e29d1d7c459 /std/os | |
| parent | 4787127cf6418f7a819c9d6f07a9046d76e0de65 (diff) | |
| parent | 05ecb49bac30041459ae08764edd2aced23d10eb (diff) | |
| download | zig-86a352c45bb654951529660b2e6cbbfa72773170.tar.gz zig-86a352c45bb654951529660b2e6cbbfa72773170.zip | |
Merge branch 'master' into pointer-reform
Diffstat (limited to 'std/os')
| -rw-r--r-- | std/os/child_process.zig | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/std/os/child_process.zig b/std/os/child_process.zig index 6c0c21f64a..dc3a582707 100644 --- a/std/os/child_process.zig +++ b/std/os/child_process.zig @@ -661,6 +661,8 @@ fn windowsCreateCommandLine(allocator: &mem.Allocator, argv: []const []const u8) var buf = try Buffer.initSize(allocator, 0); defer buf.deinit(); + var buf_stream = &io.BufferOutStream.init(&buf).stream; + for (argv) |arg, arg_i| { if (arg_i != 0) try buf.appendByte(' '); if (mem.indexOfAny(u8, arg, " \t\n\"") == null) { @@ -673,18 +675,18 @@ fn windowsCreateCommandLine(allocator: &mem.Allocator, argv: []const []const u8) switch (byte) { '\\' => backslash_count += 1, '"' => { - try buf.appendByteNTimes('\\', backslash_count * 2 + 1); + try buf_stream.writeByteNTimes('\\', backslash_count * 2 + 1); try buf.appendByte('"'); backslash_count = 0; }, else => { - try buf.appendByteNTimes('\\', backslash_count); + try buf_stream.writeByteNTimes('\\', backslash_count); try buf.appendByte(byte); backslash_count = 0; }, } } - try buf.appendByteNTimes('\\', backslash_count * 2); + try buf_stream.writeByteNTimes('\\', backslash_count * 2); try buf.appendByte('"'); } |
