authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2018-01-03 22:38:13-05:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2018-01-03 22:38:13-05:00
log0cd63b28f32fdf5aaedf9daa8ff60ec58de2f7f4
tree7c8fa7fcc53b2a9a9199bdbaed669cc165a5dba2
parent477e3f64fc632cc87956a9a6354c9069b93d5919

fix self-hosted build on windows


3 files changed, 21 insertions(+), 8 deletions(-)

build.zig+15-4
......@@ -209,8 +209,19 @@ pub fn installCHeaders(b: &Builder, c_header_files: []const u8) {
209209
210210fn nextValue(index: &usize, build_info: []const u8) -> []const u8 {
211211 const start = *index;
212 while (build_info[*index] != '\n' and build_info[*index] != '\r') : (*index += 1) { }
213 const result = build_info[start..*index];
214 *index += 1;
215 return result;
212 while (true) : (*index += 1) {
213 switch (build_info[*index]) {
214 '\n' => {
215 const result = build_info[start..*index];
216 *index += 1;
217 return result;
218 },
219 '\r' => {
220 const result = build_info[start..*index];
221 *index += 2;
222 return result;
223 },
224 else => continue,
225 }
226 }
216227}
std/os/child_process.zig+2
......@@ -15,6 +15,7 @@ const LinkedList = std.LinkedList;
1515
1616error PermissionDenied;
1717error ProcessNotFound;
18error InvalidName;
1819
1920var children_nodes = LinkedList(&ChildProcess).init();
2021
......@@ -643,6 +644,7 @@ fn windowsCreateProcess(app_name: &u8, cmd_line: &u8, envp_ptr: ?&u8, cwd_ptr: ?
643644 return switch (err) {
644645 windows.ERROR.FILE_NOT_FOUND, windows.ERROR.PATH_NOT_FOUND => error.FileNotFound,
645646 windows.ERROR.INVALID_PARAMETER => unreachable,
647 windows.ERROR.INVALID_NAME => error.InvalidName,
646648 else => os.unexpectedErrorWindows(err),
647649 };
648650 }
std/os/index.zig+4-4
......@@ -1516,8 +1516,8 @@ const unexpected_error_tracing = false;
15161516/// and you get an unexpected error.
15171517pub fn unexpectedErrorPosix(errno: usize) -> error {
15181518 if (unexpected_error_tracing) {
1519 io.stderr.printf("unexpected errno: {}\n", errno) %% return error.Unexpected;
1520 debug.printStackTrace() %% return error.Unexpected;
1519 debug.warn("unexpected errno: {}\n", errno);
1520 debug.dumpStackTrace();
15211521 }
15221522 return error.Unexpected;
15231523}
......@@ -1526,8 +1526,8 @@ pub fn unexpectedErrorPosix(errno: usize) -> error {
15261526/// and you get an unexpected error.
15271527pub fn unexpectedErrorWindows(err: windows.DWORD) -> error {
15281528 if (unexpected_error_tracing) {
1529 io.stderr.printf("unexpected GetLastError(): {}\n", err) %% return error.Unexpected;
1530 debug.printStackTrace() %% return error.Unexpected;
1529 debug.warn("unexpected GetLastError(): {}\n", err);
1530 debug.dumpStackTrace();
15311531 }
15321532 return error.Unexpected;
15331533}