Skip to content
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

Input not shown when interactive #109

Closed
ithuriel-github opened this issue Mar 24, 2022 · 4 comments
Closed

Input not shown when interactive #109

ithuriel-github opened this issue Mar 24, 2022 · 4 comments

Comments

@ithuriel-github
Copy link

May be related to #87 #94

User input is not shown when interactive

Compiled on linux musl x86_64

@jpellegrini
Copy link
Contributor

jpellegrini commented Mar 29, 2022

Hello; is this the same as issue #87 (no echo from user input)?
If so, maybe you could try PR #110 -- suggested by @philburk -- which is a one-liner.

  • I was also using musl. With libc, it works fine, so it is likely the exact same problem.

@ithuriel-github
Copy link
Author

This did solve the problem. Thank you.

@philburk
Copy link
Owner

philburk commented Apr 3, 2022

@ithuriel-github - What happens if you remove the code related to tcsetattr()?
Maybe we don't need both techniques.

@philburk philburk reopened this Apr 3, 2022
@jpellegrini
Copy link
Contributor

Hello,
Yes, it seems that calling tcsetattr is still necessary:

Calling tcsetattr:

# pforth
PForth V28-BE/32, built Mar 31 2022 16:07:57
pForth loading dictionary from file /usr/share/pforth/pforth.dic
     File format version is 10 
     Name space size = 120000 
     Code space size = 300000 
     Entry Point     = 0 
     Cell Size       = 4 
     Big Endian Dictionary

10    ok
Stack<10> 10 
20    ok
Stack<10> 10 20 
+    ok
Stack<10> 30    <== ends smoothly after ^D

If I supress the call to tcsetattr:

# pforth
PForth V28-BE/32, built Mar 31 2022 16:07:57
pForth loading dictionary from file /usr/share/pforth/pforth.dic
     File format version is 10 
     Name space size = 120000 
     Code space size = 300000 
     Entry Point     = 0 
     Cell Size       = 4 
     Big Endian Dictionary

10
10    ok
Stack<10> 10 
20
20    ok
Stack<10> 10 20 
+
+    ok
Stack<10> 30      <=== ^D here; it starts an infinite loop:
����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������    ok
Stack<10> 30 
����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������    ok
Stack<10> 30 
����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������    ok
Stack<10> 30 

I've made an adjustment to the PR indenting the call to setvbuf and checking if it returns error. Is this ok?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants