kripken/emscripten — pull request #1381 by inolen (2013-07-14 22:35:11+00:00)
Title: isatty and ttyname fixes

* moved std stream isTerminal property to object so all streams can see

Currently, `isatty(open('/dev/stdin'))` returns false as the isTerminal property is only set on the global standard stream objects (fd 1, 2 and 3).

* made ttyname use isatty to check if fd is tty

`ttyname_r` was using different conditionals than `isatty` to determine if the file descriptor belonged to a tty.

* hardcoded /dev/tty as tty name is ttyname_r

the tty name isn't necessarily the stream's path, but the path of the node it eventually resolves to. I'm a bit fuzzy here, but I believe /dev/stdin normally links to /proc/self/fd/0 which in turn links to a TTY device of sorts. For right now I've hardcoded it to simply return `/dev/tty` which is the only available tty anyways.

* fixed and changed isatty and ttyname tests to run natively

similar to some of the other pr's, I dropped the JS and output files and made it so that the tests compiled and ran natively.