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

Add lookPath function to find the path of an executable #1056

Open
wperron opened this issue Jul 22, 2021 · 8 comments
Open

Add lookPath function to find the path of an executable #1056

wperron opened this issue Jul 22, 2021 · 8 comments
Labels
enhancement New feature or request PR welcome A pull request for this issue would be welcome

Comments

@wperron
Copy link
Contributor

wperron commented Jul 22, 2021

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.

@wperron wperron added the enhancement New feature or request label Jul 22, 2021
@wperron wperron self-assigned this Jul 22, 2021
wperron added a commit to wperron/deno_std that referenced this issue Jul 22, 2021
Port of the [lookPath][1] function from Go's exec package. Fixes denoland#1056.

[1]https://pkg.go.dev/os/exec#example-LookPath
wperron added a commit to wperron/deno_std that referenced this issue Aug 10, 2021
Port of the [lookPath][1] function from Go's exec package. Fixes denoland#1056.

[1]https://pkg.go.dev/os/exec#example-LookPath
@wperron wperron removed their assignment Nov 10, 2021
@wperron
Copy link
Contributor Author

wperron commented Nov 10, 2021

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.

@lino-levan
Copy link
Contributor

I'd love to pick this up, but is this desirable @cjihrig?

@cjihrig
Copy link
Contributor

cjihrig commented Nov 5, 2022

It looks like there was no opposition to #1057, so I'm OK with it.

cc: @kt3k @bartlomieju in case the sentiment has changed in the past year.

@kt3k
Copy link
Member

kt3k commented Nov 7, 2022

I'm still in favor.

@iuioiua
Copy link
Collaborator

iuioiua commented Nov 28, 2023

We're still in favour of having this. Would anyone like to pick this up?

@lino-levan
Copy link
Contributor

I'll do it eventually, I have everything working in a branch of mine already I just need to write some tests.

@iuioiua
Copy link
Collaborator

iuioiua commented Nov 28, 2023

Would you be able to submit a draft PR just so we can start looking at and thinking about implementation?

@lino-levan
Copy link
Contributor

Yeah I'll probably get it to by thursday night. Pretty busy this week.

@iuioiua iuioiua added the PR welcome A pull request for this issue would be welcome label Jun 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request PR welcome A pull request for this issue would be welcome
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants