-
Notifications
You must be signed in to change notification settings - Fork 13
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
rbcurse functions badly with piped STDIN #14
Comments
I am not clear what you are trying to do with piping in the input. Of course, the sample is not reading in the STDIN... I will have to try this out ... the sample should read in stdin and then pass it to the main program. Yes, there are issues in ncurses itself when you move from cooked mode to raw mode and back. btw, I just tried the same thing with other programs. I did "echo some input | mc" and mc crashed. Then i tried with "vifm" and that came out saying "terminal error". Give me a little time. I'll check stackoverflow also. |
Thanks for responding so fast!
I'm trying to write a very simple program that displays URLs from text that's piped in. |
In such a case, you need to put a read loop (just like we read the ARGS in This link has examples of reading stdin in ruby. Okay I just tried out some stuff frm that link. alist = nil It printed the list but did not take input from keyboard (I had to kill the At the same time, programs like less and most do use ncurses and take In fact i will first try this on the ffi-ncurses samples if i find one that re On Sat, Feb 23, 2013 at 12:48 PM, Carl Lange [email protected]:
rahul |
I suspect this may help? https://github.com/seanohalpin/ffi-ncurses/blob/master/examples/newterm.rb |
I actually found the same thing in an example called "viewer.rb" in We need to open /dev/tty so we can read from STDIN without borkingncursesterm = CLib.fopen("/dev/tty", "rb+") screen = newterm(nil, term, term) old_screen = set_term(screen) some helper methods for working with stdlib FILE pointersmodule CLib extend FFI::Library ffi_lib FFI::Library::LIBC typedef :pointer, :FILEP FILE* open, close and eofattach_function :fopen, [:string, :string], :FILEP attach_function :fclose, [:FILEP], :int attach_function :feof, [:FILEP], :int attach_function :fflush, [:FILEP], :int attach_function :fputs, [:string, :FILEP], :int end On Sat, Feb 23, 2013 at 3:07 PM, Carl Lange [email protected]:
r |
On Sat, Feb 23, 2013 at 3:07 PM, Carl Lange [email protected]:
I have finally had some success. I used an older sample that does not use https://gist.github.com/rkumar/5019688 After start_ncurses, P put the lines about opening tty. Then i read from However, when i tried the same thing in abasiclist.rb, the screen still https://gist.github.com/rkumar/5019688rahul |
Hey, I'm having trouble with rbcurse and piped input. This is reproducible with (among others) your basiclistbox example.
$ ruby ./abasiclistbox.rb
takes input correctly, but$ echo "some input" | ruby ./abasiclistbox.rb
stops taking input and causes other glitches.I've noticed that window.getch will always return 3, instead of the actual character code.
This might be a bug further down in ncurses (or, more likely, I just haven't done something right), unfortunately I'm not well-versed enough to dive into that rabbit hole.
Any help would be greatly appreciated!
The text was updated successfully, but these errors were encountered: