Skip to content

Conversation

@furbyhaxx
Copy link

I noticed that when connected trough SSH (or using RustRover over Jetbrains Gateway) the termsize is always zero.
So I implemented a check if the "SSH_TTY" env variable is set and get the corresponding file descriptor and use that for the term size.

STDOUT_FILENO
};

let r = unsafe { ioctl(fd, TIOCGWINSZ, &mut us) };

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should there be a libc::close call here after r?

@furbyhaxx
Copy link
Author

furbyhaxx commented Jan 7, 2025 via email

};
let r = unsafe { ioctl(STDOUT_FILENO, TIOCGWINSZ, &mut us) };

let fd = if let Ok(ssh_term) = std::env::var("SSH_TTY") {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not 100% sure how it works, but what about checking for libc::isatty(libc::STDIN_FILENO) == 0 instead of SSH_TTY to make this a lot more universal?

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.

3 participants