Skip to content

Commit

Permalink
create parseCommand(cmd string) *exec.Cmd function
Browse files Browse the repository at this point in the history
  • Loading branch information
knbr13 committed Mar 28, 2024
1 parent ea9b2ab commit 4605320
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package main
import (
"io/fs"
"os"
"os/exec"
"path/filepath"
"slices"
"strings"
Expand All @@ -23,6 +24,15 @@ func addPathRecursively(root string, watcher *fsnotify.Watcher) error {
return err
}

func parseCommand(cmd string) *exec.Cmd {
cmd = strings.TrimSpace(cmd)
parts := strings.Split(cmd, " ")
if len(parts) < 2 {
return nil
}
return exec.Command(parts[0], parts[1:]...)
}

var excludedFolders = []string{
"node_modules",
"vendor",
Expand Down

0 comments on commit 4605320

Please sign in to comment.