Skip to content

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

Closed
saghul wants to merge 1 commit into
libuv:v1.xfrom
saghul:fix-tty-reopen
Closed

saghul wants to merge 1 commit into
libuv:v1.xfrom
saghul:fix-tty-reopen

Conversation

@saghul

@saghul saghul commented May 18, 2016

Copy link
Copy Markdown
Member

Comment thread src/unix/tty.c
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) {

@txdv txdv May 18, 2016 •

Copy link
Copy Markdown
Contributor

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
Copy Markdown
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
Copy Markdown
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

Gottox commented May 18, 2016

Copy link
Copy Markdown
Contributor

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

saghul commented May 18, 2016

Copy link
Copy Markdown
Member Author

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

@Gottox

Gottox commented May 18, 2016

Copy link
Copy Markdown
Contributor

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

saghul commented May 18, 2016

Copy link
Copy Markdown
Member Author

@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

saghul commented May 18, 2016

Copy link
Copy Markdown
Member Author

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

kzc commented May 18, 2016

Copy link
Copy Markdown

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

@saghul

saghul commented May 18, 2016

Copy link
Copy Markdown
Member Author

Yep, let's close it now.
On May 18, 2016 19:08, "kzc" notifications@github.com 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