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

Writing Integration Test #56

Open
DrSensor opened this issue Mar 16, 2019 · 2 comments
Open

Writing Integration Test #56

DrSensor opened this issue Mar 16, 2019 · 2 comments

Comments

@DrSensor
Copy link

DrSensor commented Mar 16, 2019

Hi, I'm currently migrating my REPL program from traditional io::stdin to linefeed. Previously I'm using rexpect in my integration tests (I'm testing the binary result). However, when I migrating to linefeed and call read_line function, it gave me Inappropriate ioctl for device (os error 25) (ENOTTY for short).

Any crates/methods you can recommend for this? 🙂

@murarth
Copy link
Owner

murarth commented Mar 16, 2019

The error means that linefeed could not initialize itself because stdin is not a terminal device. That makes sense, given that you say you are running the application from a testing program.

The solution to this issue is to have a fallback mode: When stdin is not a terminal, simply read input non-interactively.

This is actually something that linefeed should be doing, as a sensible convenience feature. I will try to implement this soon to resolve this issue.

DrSensor added a commit to DrSensor/scdlang that referenced this issue Mar 17, 2019
- No test yet until murarth/linefeed#56 resolved
- Increase max-width rule in the formatter
- Use `map_err` for clean error propagation
@murarth
Copy link
Owner

murarth commented Mar 20, 2019

I had initially thought that linefeed::Interfacecould implement a fallback non-interactive stdin reader transparently, but becase some public methods on Interface assume the existence of a valid Terminal instance, this would not be possible without some awkward API changes.

So, while it is a bit inconvenient, the best method of fallback would be to use std::io::stdin().

DrSensor added a commit to DrSensor/scdlang that referenced this issue Apr 11, 2019
- No test yet until murarth/linefeed#56 resolved
- Increase max-width rule in the formatter
- Use `map_err` for clean error propagation
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

2 participants