Skip to content

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