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

Issue running TUI app, "no such device" when trying to open /dev/tty #84

Open
bfreis opened this issue Nov 13, 2024 · 2 comments
Open
Labels
bug Something isn't working ij-upstream IntelliJ IDEA upstream bug

Comments

@bfreis
Copy link

bfreis commented Nov 13, 2024

I'm not sure if this is new from v20 or if the issue existed before, but I can't seem to be able to run an app that needs a pty.

Consider this code:

pub fn main() !void {
    var tty: fs.File = try fs.cwd().openFile("/dev/tty", .{ .mode = .read_write });
    defer tty.close();
}

If I open a terminal, and run it with zig build run, it executes succesfully and finishes with 0 status code.

If I run from IntelliJ, it fails when opening /dev/tty, with error unexpected errno: 6 (i.e., NXIO or "no such device", apparently not handled properly in Zig). I saw a checkbox "Enable terminal" on the run configuration, but the same issue happens with or without it. I remember many years ago I had a similar issue with Goland (as a plugin in IntelliJ), but somehow it started working. I even found an issue on YouTrack where I posted. I tried the same workarounds (i.e. use -Drun.processes.with.pty=true in the VM Options, and enable run.processes.with.pty on the "registry"), but nothing worked.

For context, I tried on 2024.2.3, 2024.2.4, and on 2024.3 RC. I'm running on a Mac with Apple silicon and Sequoia 15.1.

Any ideas?
Thanks!

@FalsePattern FalsePattern added the bug Something isn't working label Nov 13, 2024
@FalsePattern
Copy link
Owner

I've investigated deeper, it seems like the intellij "TTY emulation" just parses the color information from stdout, it does not actually provide a /dev/tty environment. For that, you need to use the intellij built-in terminal or an external terminal for tty-requiring code for the time being.

@FalsePattern
Copy link
Owner

For reference, this also happens with Rust in RustRover
image

@FalsePattern FalsePattern added the ij-upstream IntelliJ IDEA upstream bug label Nov 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working ij-upstream IntelliJ IDEA upstream bug
Projects
None yet
Development

No branches or pull requests

2 participants