Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

🔍 find app path and print it.

License

NotificationsYou must be signed in to change notification settings

abdfnx/looker

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🔍 find app path and print it.

A alternative package toexec.LookPath().

The problem

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

Install

go get -v github.com/abdfnx/looker@v0.1.0

Example:

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()}

Packages

No packages published

Languages

  • Go100.0%

[8]ページ先頭

©2009-2025 Movatter.jp