From 2c041f22bf794d79c0a0aac1bde459af37df78c9 Mon Sep 17 00:00:00 2001 From: Yannick Dorn Date: Tue, 29 Nov 2022 22:07:18 -0500 Subject: [PATCH] things I noticed to cleanup while making the pr --- frontend/src/api/commands.js | 1 - http/commands.go | 6 ------ runner/parser.go | 5 +---- 3 files changed, 1 insertion(+), 11 deletions(-) diff --git a/frontend/src/api/commands.js b/frontend/src/api/commands.js index b5bf8f36..790c22a7 100644 --- a/frontend/src/api/commands.js +++ b/frontend/src/api/commands.js @@ -7,7 +7,6 @@ const protocol = ssl ? "wss:" : "ws:"; export default function command(url, command, onmessage, onclose) { url = removePrefix(url); - console.log(command) url = `${protocol}//${window.location.host}${baseURL}/api/command${url}?auth=${store.state.jwt}`; let conn = new window.WebSocket(url); diff --git a/http/commands.go b/http/commands.go index d513240d..75bde655 100644 --- a/http/commands.go +++ b/http/commands.go @@ -2,7 +2,6 @@ package http import ( "bufio" - "fmt" "io" "log" "net/http" @@ -62,7 +61,6 @@ var commandsHandler = withUser(func(w http.ResponseWriter, r *http.Request, d *d command, err := runner.ParseCommand(d.settings, raw, r.URL.Path) - // fmt.Println("Full Command: ", command) if err != nil { if err := conn.WriteMessage(websocket.TextMessage, []byte(err.Error())); err != nil { //nolint:govet @@ -80,25 +78,21 @@ var commandsHandler = withUser(func(w http.ResponseWriter, r *http.Request, d *d } cmd := exec.Command(command[0], command[1:]...) //nolint:gosec - // needs glob expansion somehow cmd.Dir = d.user.FullPath(r.URL.Path) stdout, err := cmd.StdoutPipe() if err != nil { - fmt.Println("or here") wsErr(conn, r, http.StatusInternalServerError, err) return 0, nil } stderr, err := cmd.StderrPipe() if err != nil { - fmt.Println("failed here") wsErr(conn, r, http.StatusInternalServerError, err) return 0, nil } if err := cmd.Start(); err != nil { - fmt.Println("or there") wsErr(conn, r, http.StatusInternalServerError, err) return 0, nil } diff --git a/runner/parser.go b/runner/parser.go index d866163a..ccd84eec 100644 --- a/runner/parser.go +++ b/runner/parser.go @@ -1,7 +1,6 @@ package runner import ( - "fmt" "os/exec" "path/filepath" "strings" @@ -22,7 +21,7 @@ func GlobExpand(args []string, cwd string) ([]string, error) { if err != nil { return nil, err } - //No match means the argument is just appended to the end. + //No match means the argument is fine so just appended to the end. if len(matches) == 0 { expandedArgs = append(expandedArgs, arg) } else { @@ -86,7 +85,5 @@ func ParseCommand(s *settings.Settings, raw string, cwd string) ([]string, error command = append(s.Shell, raw) //nolint:gocritic } - fmt.Println("Final Command: ", command) - return command, nil }