Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

show command stderr of failure #33

Merged
merged 1 commit into from
Jun 24, 2023
Merged

Conversation

dweiller
Copy link

Now without a deadlock.

I've testing against this program with byte count up to 100 000 000 000:

pub fn main() !void {
    const stderr = std.io.getStdErr();

    const byte_count = if (std.os.argv.len > 1)
        try std.fmt.parseInt(usize, std.mem.span(std.os.argv[1]), 10)
    else
        1 << 20;

    const bytes = "DeadLock" ** 512;

    var bytes_written: usize = 0;
    while (bytes_written + bytes.len <= byte_count) {
        bytes_written += try stderr.write(bytes);
    }

    if (bytes_written < byte_count) {
        try stderr.writeAll(bytes[0..][0 .. byte_count - bytes_written]);
    }

    std.process.exit(1);
}

const std = @import("std");

@andrewrk andrewrk merged commit 3b9b4b9 into andrewrk:main Jun 24, 2023
@andrewrk
Copy link
Owner

Thanks for the follow-up!

@dweiller dweiller deleted the child-stderr branch June 24, 2023 06:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants