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

Specifying directory path in Inspectify #37

Open
martin045k opened this issue Mar 29, 2023 · 5 comments · May be fixed by #40
Open

Specifying directory path in Inspectify #37

martin045k opened this issue Mar 29, 2023 · 5 comments · May be fixed by #40
Labels
bug Something isn't working

Comments

@martin045k
Copy link
Contributor

It would appear that, at least on Windows, if one runs Inspectify with a directory argument, then it is unable of running the F# code. However, if Inspectify is run from the directory containing the F# code, then Inspectify will run as expected.

The screenshots below tested on a fresh F# starter project hopefully provide some information regarding the issue in question:

This is the command used to run Inspectify:
InspectifyCommand

This is the error yielded by Inspectify:
InspectifyError

Finally, when running Inspectify from the folder with the source, it works as expected:
InspectifyOk

@oeb25 oeb25 added the bug Something isn't working label Apr 2, 2023
@martin045k
Copy link
Contributor Author

Furthermore, it would appear that it is trying to run ./bin/run/calculator and that the current directory to the commands in driver.rs is specified using cmd.current_dir, though, according to the documentation for current_dir, there seemingly may be ambiguity regarding whether the program is to be run from the current_dir directory or the parent's working directory. I was therefore wondering, if this could possibly be part of the reason behind the error?

@oeb25
Copy link
Member

oeb25 commented Apr 3, 2023

I think you're on to something here! I never knew about this, good find! It would explain why this issue only appears on some systems.

The fix, I believe, would be to determine if the executable referred to in the script is a relative path, and if so, append that to the cwd and canonicalize it.

I've drafted a possible fix, but can't test it on Windows just now.

oeb25 added a commit that referenced this issue Apr 3, 2023
@martin045k
Copy link
Contributor Author

I have just checked pr #40, I unfortunately still encounter an OS Error on my Windows 10 machine, in this case, os error 2 when attempting to run Inspectify, both when specifying a directory and when running Inspectify when cd'd into the folder with the F# code in it.

InspectifyErrorWindows

I have tried to fix the issue in my dir-path-bug branch, and it seemingly solves the issue, though the fix itself is a tad messy, as it modifies the new_command function in driver.rs, to handle the run_cmd argument differently, if Windows is detected as the OS.

More specifically, it prepends the user described dir path to the run_cmd path, applying a few formatting changes to make sure they can be combined appropriately, using the new functions format_cmd and clear_format.

I can create a pull request for it, if it is of interest?

@oeb25
Copy link
Member

oeb25 commented Sep 18, 2023

Sorry for the delay @martin045k, but this seems great! If you are still up for it, please feel free to open a PR, and I can try to dig a little deeper so we can get this fixed!

@martin045k
Copy link
Contributor Author

Thanks 😄 I've opened a PR (#48) for the issue, though please be aware, that it is not fully up-to-date with main (about 4 commits behind), and I've also only had the opportunity to test it on Windows 10, so it will probably be a good idea to double check that everything about it seems reasonable. Anyhow, I hope that it will bring us a step closer to solving the issue as a whole 🙂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants