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

EBADF in stdout #2555

Closed
shritesh opened this issue May 26, 2019 · 1 comment
Closed

EBADF in stdout #2555

shritesh opened this issue May 26, 2019 · 1 comment

Comments

@shritesh
Copy link
Contributor

shritesh commented May 26, 2019

This compiles but crashes with EBADF

const std = @import("std");
const io = std.io;

pub fn main() !void { 
    const stdout_file = try io.getStdOut();
    var stdout = stdout_file.outStream().stream;                                                                                             
    try stdout.print("hello world\n");                                                                                                          
}

Changing to the following fixes the problem

const stdout = &stdout_file.outStream().stream;                                                                                             

Update: The following causes a compile time error instead

const stdout = stdout_file.outStream().stream;

This might be related to #2428
I’m on Linux x86_64, Ubuntu 18.04, Zig Master

@shritesh
Copy link
Contributor Author

@andrewrk on IRC mentioned that this is a duplicate of #591

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

No branches or pull requests

1 participant