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) {...@@ -209,8 +209,19 @@ pub fn installCHeaders(b: &Builder, c_header_files: []const u8) {
209209
210fn nextValue(index: &usize, build_info: []const u8) -> []const u8 {210fn nextValue(index: &usize, build_info: []const u8) -> []const u8 {
211 const start = *index;211 const start = *index;
212 while (build_info[*index] != '\n' and build_info[*index] != '\r') : (*index += 1) { }212 while (true) : (*index += 1) {
213 const result = build_info[start..*index];213 switch (build_info[*index]) {
214 *index += 1;214 '\n' => {
215 return result;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 }
216}227}
std/os/child_process.zig+2
...@@ -15,6 +15,7 @@ const LinkedList = std.LinkedList;...@@ -15,6 +15,7 @@ const LinkedList = std.LinkedList;
1515
16error PermissionDenied;16error PermissionDenied;
17error ProcessNotFound;17error ProcessNotFound;
18error InvalidName;
1819
19var children_nodes = LinkedList(&ChildProcess).init();20var children_nodes = LinkedList(&ChildProcess).init();
2021
...@@ -643,6 +644,7 @@ fn windowsCreateProcess(app_name: &u8, cmd_line: &u8, envp_ptr: ?&u8, cwd_ptr: ?...@@ -643,6 +644,7 @@ fn windowsCreateProcess(app_name: &u8, cmd_line: &u8, envp_ptr: ?&u8, cwd_ptr: ?
643 return switch (err) {644 return switch (err) {
644 windows.ERROR.FILE_NOT_FOUND, windows.ERROR.PATH_NOT_FOUND => error.FileNotFound,645 windows.ERROR.FILE_NOT_FOUND, windows.ERROR.PATH_NOT_FOUND => error.FileNotFound,
645 windows.ERROR.INVALID_PARAMETER => unreachable,646 windows.ERROR.INVALID_PARAMETER => unreachable,
647 windows.ERROR.INVALID_NAME => error.InvalidName,
646 else => os.unexpectedErrorWindows(err),648 else => os.unexpectedErrorWindows(err),
647 };649 };
648 }650 }
std/os/index.zig+4-4
...@@ -1516,8 +1516,8 @@ const unexpected_error_tracing = false;...@@ -1516,8 +1516,8 @@ const unexpected_error_tracing = false;
1516/// and you get an unexpected error.1516/// and you get an unexpected error.
1517pub fn unexpectedErrorPosix(errno: usize) -> error {1517pub fn unexpectedErrorPosix(errno: usize) -> error {
1518 if (unexpected_error_tracing) {1518 if (unexpected_error_tracing) {
1519 io.stderr.printf("unexpected errno: {}\n", errno) %% return error.Unexpected;1519 debug.warn("unexpected errno: {}\n", errno);
1520 debug.printStackTrace() %% return error.Unexpected;1520 debug.dumpStackTrace();
1521 }1521 }
1522 return error.Unexpected;1522 return error.Unexpected;
1523}1523}
...@@ -1526,8 +1526,8 @@ pub fn unexpectedErrorPosix(errno: usize) -> error {...@@ -1526,8 +1526,8 @@ pub fn unexpectedErrorPosix(errno: usize) -> error {
1526/// and you get an unexpected error.1526/// and you get an unexpected error.
1527pub fn unexpectedErrorWindows(err: windows.DWORD) -> error {1527pub fn unexpectedErrorWindows(err: windows.DWORD) -> error {
1528 if (unexpected_error_tracing) {1528 if (unexpected_error_tracing) {
1529 io.stderr.printf("unexpected GetLastError(): {}\n", err) %% return error.Unexpected;1529 debug.warn("unexpected GetLastError(): {}\n", err);
1530 debug.printStackTrace() %% return error.Unexpected;1530 debug.dumpStackTrace();
1531 }1531 }
1532 return error.Unexpected;1532 return error.Unexpected;
1533}1533}