Skip to content

Commit

Permalink
quote commands
Browse files Browse the repository at this point in the history
  • Loading branch information
et-nik committed Feb 14, 2024
1 parent a3d7767 commit 16a1427
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions internal/processmanager/tmux.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"fmt"
"io"
"os/user"
"strconv"

"github.com/gameap/daemon/internal/app/config"
"github.com/gameap/daemon/internal/app/contracts"
Expand Down Expand Up @@ -42,7 +43,7 @@ func (pm *Tmux) Start(

result, err := pm.executor.ExecWithWriter(
ctx,
fmt.Sprintf(`tmux new-session -d -s %s -x %d "%s"`, server.UUID(), defaultWidth, startCmd),
fmt.Sprintf(`tmux new-session -d -s %s -x %d "%s"`, server.UUID(), defaultWidth, strconv.Quote(startCmd)),
out,
options,
)
Expand Down Expand Up @@ -155,7 +156,7 @@ func (pm *Tmux) SendInput(

result, err := pm.executor.ExecWithWriter(
ctx,
fmt.Sprintf(`tmux send-keys -t %s "%s" ENTER`, server.UUID(), input),
fmt.Sprintf(`tmux send-keys -t %s "%s" ENTER`, server.UUID(), strconv.Quote(input)),
out,
options,
)
Expand Down

0 comments on commit 16a1427

Please sign in to comment.