Stream::fd
pub fn fd() -> Result<int, IoError> Import
Source: use io::{Stream}; compiler/src/builtin_docs/io.hy Returns the OS file descriptor (socket handle on Windows) of this stream.
The descriptor stays owned by the stream: do not close it yourself.
stdin, stdout and stderr return duplicated descriptors, so their
fd is not 0, 1 or 2. Returns Err(IoError::InvalidInput) once
the stream is closed.
Called on a Stream value as value.fd(…).
Returns#
Result<int, IoError>
Examples#
use io::{stdout};
use tests::assert;
let fd = match stdout().fd() {
Result::Ok(fd) => fd,
Result::Err(_) => -1,
};
assert!(fd >= 0);
See also#
io::stdinio::stdoutio::stderrStream: An open file, socket or standard stream.Stream::attach: Installs package IO hooks on this stream in place and returns the same stream.Stream::park: Waits until this stream’s descriptor is ready.