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

unix,tty: reopen /dev/tty for stdio fds #878

Closed
wants to merge 1 commit into from

Conversation

saghul
Copy link
Member

@saghul saghul commented May 18, 2016

if (uv__tty_is_slave(fd) && ttyname_r(fd, path, sizeof(path)) == 0)
if (fd <= STDERR_FILENO) {
r = uv__open_cloexec("/dev/tty", O_RDWR);
} else if (uv__tty_is_slave(fd) && ttyname_r(fd, path, sizeof(path)) == 0) {
Copy link
Contributor

@txdv txdv May 18, 2016

Choose a reason for hiding this comment

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

Can we rename slave to follower so we won't get another shitstorm?

Copy link
Member Author

Choose a reason for hiding this comment

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

Andrius, I'm not really in the mood for this crap. We use the terminology in man 4 pty. End of the discussion.

Copy link
Contributor

Choose a reason for hiding this comment

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

It was merely a suggestion.

@Gottox
Copy link
Contributor

Gottox commented May 18, 2016

This will break writing to other ttys again:

node test.js > /dev/tty0

I'm okay with that. Just be aware, that this adds another layer of unexpected behavior.

@saghul
Copy link
Member Author

saghul commented May 18, 2016

Damn, we can't win here, can we? 😭

@Gottox
Copy link
Contributor

Gottox commented May 18, 2016

I think this fix is a good tradeoff. At least my usecases are fixed with libuv for now and you cannot break software in production. (Sorry, that I did)

@saghul
Copy link
Member Author

saghul commented May 18, 2016

@Gottox It's not your fault in any way! OSX is really weird, /dev/tty cannot be used with kqueue whereas /dev/ttys* can, which creates some interesting side-effects.

I'm not sure we can get away without any tradeoff, but this one seems reasonable to me. Maybe I should mention it in the docs too. @libuv/collaborators WDYT?

@saghul
Copy link
Member Author

saghul commented May 18, 2016

This is an ugly hack. I think I caught a bug which was hiding in plain sight: #879 so basically any tty which was opened using the select() trick resulted in blocking writes, even if we could do them async anyway.

With #879 the beahvior is consistent and we retain tty redirection working. I'd still like some more feedback on this whole thing, I might not be seeing the forest because of the threes.

@kzc
Copy link

kzc commented May 18, 2016

@saghul Do you intend to close this PR due to the findings in this discussion?
nodejs/node#6456 (comment)

@saghul
Copy link
Member Author

saghul commented May 18, 2016

Yep, let's close it now.
On May 18, 2016 19:08, "kzc" [email protected] wrote:

@saghul https://github.com/saghul Do you intend to close this PR due to
the findings in this discussion?
nodejs/node#6456 (comment)
nodejs/node#6456 (comment)


You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub
#878 (comment)

@saghul saghul closed this May 18, 2016
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.

4 participants