-
Notifications
You must be signed in to change notification settings - Fork 10
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
Use standard error #5
Comments
That's a great idea! Do you think amending the |
I would rather add a var ln = Linenoise.init(allocator);
// read from stdin
ln.linenoise("This is read from stdin: ");
// read from tty
var tty = std.fs.openFileAbsolute("/dev/tty", .{ });
ln.file_descriptor = tty;
ln.linenoise("This is read using /dev/tty: ");
// read from stderr
ln.file_descriptor = std.io.getStdErr();
ln.linenoise("This is read using stderr: "); If setting the file descriptor requires more complicated internal logic than assigning to a variable, then it could be |
Ok, putting it in the |
I would recommend not closing it in |
I have similar concerns not only about stdout/stderr, but more generally: it would be much better to pass and File struct as an input / output. Especially for programs that can consume piped input, but still want to display text user interface on a I made a fork with added constructor: see https://github.com/omgtehlion/linenoize-win32/blob/b4ed601f86151b5ab0b12332a47107e504ab6ca0/src/main.zig#L178 Not still sure, do we need a full File struct or only Handle |
@omgtehlion, what about accepting a |
Yeah, a pair of |
I prefer the |
Could it detect buffered, and flush it? |
I am using this library in a program that needs to do user interaction on stderr, in order to pipe useful data from stdout.
Would it be possible to configure the file descriptor? Not only stdin/stdout, but arbitrary file descriptor, because some programs use stdout for data output, stderr for error messages, and
/dev/tty
for UI. If/dev/tty
would be supported, I would probably switch my program to use that.The text was updated successfully, but these errors were encountered: