ozil icon indicating copy to clipboard operation
ozil copied to clipboard

Don't provide silly suggestions for project binaries

Open typesanitizer opened this issue 7 years ago • 2 comments

We should already check if the help page exists and then provide it as a possible suggestion. The current behaviour is silly and results in lots of false positives.

EDIT: Turns out I was wrong. stack exec rg -- --help is perfectly fine.

typesanitizer avatar Nov 24 '18 02:11 typesanitizer

The silly suggestion seems to be coming from the fact that stack actually doesn't do any input validation. If you give it some other binary which exists on your $PATH, it will just run it, no questions asked. Amazing. My guess is that it probably just temporarily modifies the environment to include the path to the project binaries and then runs the command. So for stack, we should probably search the binary folder.

typesanitizer avatar Nov 24 '18 02:11 typesanitizer

For stack, we can run stack path. Look at the lines beginning with

  • project-root - this gives the absolute path for the project root
  • dist-dir - this gives the relative path for where the binaries might be

Then do a recursive search for the binary under project-root </> dist-dir.

typesanitizer avatar Nov 24 '18 02:11 typesanitizer