denoland / denoland/std

Add `lookPath` function to find the path of an executable

Open
#1,056 8 comments 2 reactions 0 assignees View on GitHub
enhancement PR welcome
Dominant language
TypeScript
Stars
3.6k
Forks
681
PR merge metrics
No merged PRs in 30d

Description

Golang's exec package has this neat [`LookPath` function](https://pkg.go.dev/os/exec#LookPath) 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:

```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.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.