Anonymous user
Check input device is a terminal: Difference between revisions
→{{header|Scala}}
(Scala solution added) |
|||
Line 318:
// We must be on some unix variant..
try {
enabled && isatty(
}
catch {
Line 330:
println("tty " + apply(true))
}</lang>
=={{header|Tcl}}==
Tcl automatically detects whether <tt>stdin</tt> is coming from a terminal (or a socket) and sets up the channel to have the correct type. One of the configuration options of a terminal channel is <tt>-mode</tt> (used to configure baud rates on a real serial terminal) so we simply detect whether the option is present.
|