forked fromTimothee-Cardoso/tc-exe
- Notifications
You must be signed in to change notification settings - Fork0
🔍 find app path and print it.
License
NotificationsYou must be signed in to change notification settings
abdfnx/looker
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
🔍 find app path and print it.
A alternative package toexec.LookPath()
.
The following code, relatively common approach to running external commands has a vulnerability on Windows:
import"os/exec"funcgitAdd()error {cmd:=exec.Command("git","add","Formula")returncmd.Run()}
Searching the current directory (surprising behavior) before searching folders listed in the PATH environment variable (expected behavior) seems to be intended in Go and unlikely to be changedgo#38736
go get -v github.com/abdfnx/looker@v0.1.0
import ("os/exec""github.com/abdfnx/looker")funcgitAdd()error {gitPath,err:=looker.LookPath("git")iferr!=nil {returnerr }cmd:=exec.Command(gitPath,"add","Formula")returncmd.Run()}
About
🔍 find app path and print it.
Topics
Resources
License
Code of conduct
Stars
Watchers
Forks
Packages0
No packages published
Languages
- Go100.0%