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

cargo insta review fails with `Incorrect function. (os error 1) #79

Closed
MichaelMcDonnell opened this issue Oct 15, 2019 · 7 comments
Closed
Labels
need-more-info Further information is requested

Comments

@MichaelMcDonnell
Copy link
Contributor

I'm trying to update a snapshot with the cargo insta review but get the error message `Incorrect function. (os error 1). It only happens when I use Git Bash on Windows. Using cmd.exe works fine.

Steps to reproduce:

  1. Open Git Bash on Windows
  2. Change the directory to a project that has a snapshot test
  3. Modify a test so the snapshot doesn't match
  4. Run cargo insta review
  5. Notice the normal message that the snapshot has changed and that you get options to accept, reject or skip.
  6. Notice that you cannot enter your choice because of the error message `error: Incorrect function. (os error 1).

Again, using cmd.exe works fine.

@MichaelMcDonnell
Copy link
Contributor Author

Two of my colleagues tried to reproduce it but it worked fine for them. There seem to be something odd about my machine. I've tried to remove MinGW from my path but I still get the same result.

@mitsuhiko
Copy link
Owner

I cannot reproduce this.

@mitsuhiko mitsuhiko added the need-more-info Further information is requested label Oct 23, 2019
@MichaelMcDonnell
Copy link
Contributor Author

I can also reproduce this on my home machine.

Any ideas how I can figure out what is going on? I do not see any logging in cargo-insta?

@mitsuhiko
Copy link
Owner

@MichaelMcDonnell first thing to try is if RUST_BACKTRACE=1 shows something.

When I was googling for the issue I found this which suggested it might have something to do with the subsystem for linux: rust-lang/cargo#7511 — so the culprits might be operations on the path. For instance we might canonicalize somewhere, where this is unsafe to do on windows.

@MichaelMcDonnell
Copy link
Contributor Author

Thanks for your suggestion and the googling. That referenced issue sounds like what I'm seeing, except I'm not using WSL.

Using RUST_BACKTRACE=1 did not do anything. I think that makes sense because it is not a panic.

I added some println! logs and it is the call to read_key in query_snapshot that fails. The read_key function is from the console crate. I'll try sometime soon to check that out and see what is going on.

@max-sixty
Copy link
Sponsor Collaborator

(should we close? This is from 2019)

@MichaelMcDonnell
Copy link
Contributor Author

Closing the issue. I'm not using insta anymore.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
need-more-info Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants