deno_std
deno_std copied to clipboard
Add `lookPath` function to find the path of an executable
Golang's exec package has this neat LookPath function that allows finding the absolute path to an executable by it's shortname that I think would be useful in the Deno standard lib. Here's an example usage in Go:
package main
import (
"fmt"
"log"
"os/exec"
)
func main() {
path, err := exec.LookPath("fortune")
if err != nil {
log.Fatal("installing fortune is in your future")
}
fmt.Printf("fortune is available at %s\n", path)
}
Since we don't have an exec package, I propose we put this function in the fs package, though path would also be a good choice.
If anyone wants to pick up where I left off, all that was left on my branch was to add tests for windows and validate that it works there, I doubt that it wouldn't. I no longer have the time (or even a Windows machine) to carry on this issue.
I'd love to pick this up, but is this desirable @cjihrig?
It looks like there was no opposition to https://github.com/denoland/deno_std/pull/1057, so I'm OK with it.
cc: @kt3k @bartlomieju in case the sentiment has changed in the past year.
I'm still in favor.
We're still in favour of having this. Would anyone like to pick this up?
I'll do it eventually, I have everything working in a branch of mine already I just need to write some tests.
Would you be able to submit a draft PR just so we can start looking at and thinking about implementation?
Yeah I'll probably get it to by thursday night. Pretty busy this week.