| author | |
| committer | |
| log | a6d72fea06364da26b4efacb188303c5bddf5da3 |
| tree | 07dbec9fc4e1923a4c23f720913f6b3a2ff4d4c9 |
| parent | ea4a25287eb65e639fd75d425f320663e6e8dca1 |
This patch adjusts the exit code for a child process to be a u8. Since
the WEXITSTATUS macro returns the lower eight bits, it's safe to assume
that we can truncate the returned u32.8 files changed, 16 insertions(+), 16 deletions(-)
lib/std/child_process.zig+2-2| ... | ... | @@ -78,7 +78,7 @@ pub const ChildProcess = struct { |
| 78 | 78 | } || os.ExecveError || os.SetIdError || os.ChangeCurDirError || windows.CreateProcessError || windows.WaitForSingleObjectError; |
| 79 | 79 | |
| 80 | 80 | pub const Term = union(enum) { |
| 81 | Exited: u32, | |
| 81 | Exited: u8, | |
| 82 | 82 | Signal: u32, |
| 83 | 83 | Stopped: u32, |
| 84 | 84 | Unknown: u32, |
| ... | ... | @@ -347,7 +347,7 @@ pub const ChildProcess = struct { |
| 347 | 347 | if (windows.kernel32.GetExitCodeProcess(self.handle, &exit_code) == 0) { |
| 348 | 348 | break :x Term{ .Unknown = 0 }; |
| 349 | 349 | } else { |
| 350 | break :x Term{ .Exited = exit_code }; | |
| 350 | break :x Term{ .Exited = @truncate(u8, exit_code) }; | |
| 351 | 351 | } |
| 352 | 352 | }); |
| 353 | 353 |
lib/std/os/bits/darwin.zig+2-2| ... | ... | @@ -844,8 +844,8 @@ fn wstatus(x: u32) u32 { |
| 844 | 844 | return x & 0o177; |
| 845 | 845 | } |
| 846 | 846 | const wstopped = 0o177; |
| 847 | pub fn WEXITSTATUS(x: u32) u32 { | |
| 848 | return x >> 8; | |
| 847 | pub fn WEXITSTATUS(x: u32) u8 { | |
| 848 | return @intCast(u8, x >> 8); | |
| 849 | 849 | } |
| 850 | 850 | pub fn WTERMSIG(x: u32) u32 { |
| 851 | 851 | return wstatus(x); |
lib/std/os/bits/dragonfly.zig+2-2| ... | ... | @@ -332,8 +332,8 @@ pub const AT_REMOVEDIR = 2; |
| 332 | 332 | pub const AT_EACCESS = 4; |
| 333 | 333 | pub const AT_SYMLINK_FOLLOW = 8; |
| 334 | 334 | |
| 335 | pub fn WEXITSTATUS(s: u32) u32 { | |
| 336 | return (s & 0xff00) >> 8; | |
| 335 | pub fn WEXITSTATUS(s: u32) u8 { | |
| 336 | return @intCast(u8, (s & 0xff00) >> 8); | |
| 337 | 337 | } |
| 338 | 338 | pub fn WTERMSIG(s: u32) u32 { |
| 339 | 339 | return s & 0x7f; |
lib/std/os/bits/freebsd.zig+2-2| ... | ... | @@ -729,8 +729,8 @@ pub const TIOCGSID = 0x40047463; |
| 729 | 729 | pub const TIOCGPTN = 0x4004740f; |
| 730 | 730 | pub const TIOCSIG = 0x2004745f; |
| 731 | 731 | |
| 732 | pub fn WEXITSTATUS(s: u32) u32 { | |
| 733 | return (s & 0xff00) >> 8; | |
| 732 | pub fn WEXITSTATUS(s: u32) u8 { | |
| 733 | return @intCast(u8, (s & 0xff00) >> 8); | |
| 734 | 734 | } |
| 735 | 735 | pub fn WTERMSIG(s: u32) u32 { |
| 736 | 736 | return s & 0x7f; |
lib/std/os/bits/haiku.zig+2-2| ... | ... | @@ -661,8 +661,8 @@ pub const TIOCSBRK = 0x8020; |
| 661 | 661 | pub const TIOCCBRK = 0x8021; |
| 662 | 662 | pub const TIOCGSID = 0x8024; |
| 663 | 663 | |
| 664 | pub fn WEXITSTATUS(s: u32) u32 { | |
| 665 | return (s & 0xff); | |
| 664 | pub fn WEXITSTATUS(s: u32) u8 { | |
| 665 | return @intCast(u8, s & 0xff); | |
| 666 | 666 | } |
| 667 | 667 | |
| 668 | 668 | pub fn WTERMSIG(s: u32) u32 { |
lib/std/os/bits/linux.zig+2-2| ... | ... | @@ -1043,8 +1043,8 @@ pub const TFD_CLOEXEC = O_CLOEXEC; |
| 1043 | 1043 | pub const TFD_TIMER_ABSTIME = 1; |
| 1044 | 1044 | pub const TFD_TIMER_CANCEL_ON_SET = (1 << 1); |
| 1045 | 1045 | |
| 1046 | pub fn WEXITSTATUS(s: u32) u32 { | |
| 1047 | return (s & 0xff00) >> 8; | |
| 1046 | pub fn WEXITSTATUS(s: u32) u8 { | |
| 1047 | return @intCast(u8, (s & 0xff00) >> 8); | |
| 1048 | 1048 | } |
| 1049 | 1049 | pub fn WTERMSIG(s: u32) u32 { |
| 1050 | 1050 | return s & 0x7f; |
lib/std/os/bits/netbsd.zig+2-2| ... | ... | @@ -686,8 +686,8 @@ pub const TIOCSWINSZ = 0x80087467; |
| 686 | 686 | pub const TIOCUCNTL = 0x80047466; |
| 687 | 687 | pub const TIOCXMTFRAME = 0x80087444; |
| 688 | 688 | |
| 689 | pub fn WEXITSTATUS(s: u32) u32 { | |
| 690 | return (s >> 8) & 0xff; | |
| 689 | pub fn WEXITSTATUS(s: u32) u8 { | |
| 690 | return @intCast(u8, (s >> 8) & 0xff); | |
| 691 | 691 | } |
| 692 | 692 | pub fn WTERMSIG(s: u32) u32 { |
| 693 | 693 | return s & 0x7f; |
lib/std/os/bits/openbsd.zig+2-2| ... | ... | @@ -669,8 +669,8 @@ pub const TIOCSWINSZ = 0x80087467; |
| 669 | 669 | pub const TIOCUCNTL = 0x80047466; |
| 670 | 670 | pub const TIOCXMTFRAME = 0x80087444; |
| 671 | 671 | |
| 672 | pub fn WEXITSTATUS(s: u32) u32 { | |
| 673 | return (s >> 8) & 0xff; | |
| 672 | pub fn WEXITSTATUS(s: u32) u8 { | |
| 673 | return @intCast(u8, (s >> 8) & 0xff); | |
| 674 | 674 | } |
| 675 | 675 | pub fn WTERMSIG(s: u32) u32 { |
| 676 | 676 | return (s & 0x7f); |