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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Windows escaping issues #314

Merged
merged 5 commits into from
Aug 11, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
fix: Windows escaping issue
Signed-off-by: Valentin Kiselev <[email protected]>
  • Loading branch information
mrexox committed Aug 10, 2022
commit e41b0a98e99a25cb84aeef8db7591309b5c821ec
8 changes: 7 additions & 1 deletion internal/lefthook/runner/execute_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,18 @@ import (
"os"
"os/exec"
"path/filepath"
"strings"
"syscall"
)

type CommandExecutor struct{}

func (e CommandExecutor) Execute(root string, args []string) (*bytes.Buffer, error) {
command := exec.Command(args[0], args[1:]...)
command := exec.Command(args[0])
command.SysProcAttr = &syscall.SysProcAttr{
CmdLine: strings.Join(args, " "),
}

rootDir, _ := filepath.Abs(root)
command.Dir = rootDir

Expand Down