support shell cmd split

This commit is contained in:
lzh
2025-07-07 09:20:15 +08:00
parent a1ab697848
commit c54e81321e
4 changed files with 8 additions and 3 deletions

1
go.mod
View File

@@ -97,6 +97,7 @@ require (
github.com/gin-gonic/gin v1.9.1
github.com/glebarez/sqlite v1.11.0
github.com/golang-jwt/jwt v3.2.2+incompatible
github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510
github.com/olivere/elastic/v7 v7.0.32
github.com/panjf2000/ants/v2 v2.10.0
github.com/robfig/cron/v3 v3.0.1

2
go.sum
View File

@@ -77,6 +77,8 @@ github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeN
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
github.com/google/pprof v0.0.0-20221118152302-e6195bd50e26 h1:Xim43kblpZXfIBQsbuBVKCudVG457BR2GZFIz3uw3hQ=
github.com/google/pprof v0.0.0-20221118152302-e6195bd50e26/go.mod h1:dDKJzRmX4S37WGHujM7tX//fmj1uioxKzKxz3lo4HJo=
github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 h1:El6M4kTTCOh6aBiKaUGG7oYTSPP8MxqL4YI3kZKwcP4=
github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510/go.mod h1:pupxD2MaaD3pAXIBCelhxNneeOaAeabZDe5s4K6zSpQ=
github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I=
github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/gorilla/websocket v1.5.1 h1:gmztn0JnHVt9JZquRuzLw3g4wouNVzKL15iLr/zn/QY=

View File

@@ -6,6 +6,7 @@ import (
"os/exec"
"strings"
"github.com/google/shlex"
"github.com/lzh-1625/go_process_manager/config"
"github.com/lzh-1625/go_process_manager/internal/app/constants"
"github.com/lzh-1625/go_process_manager/internal/app/model"
@@ -133,7 +134,7 @@ func (p *ProcessPty) doOnInit() {
func NewProcessPty(pconfig model.Process) *ProcessBase {
p := ProcessBase{
Name: pconfig.Name,
StartCommand: strings.Split(pconfig.Cmd, " "),
StartCommand: utils.UnwarpIgnore(shlex.Split(pconfig.Cmd)),
WorkDir: pconfig.Cwd,
}
processPty := ProcessPty{

View File

@@ -4,7 +4,8 @@ import (
"bufio"
"io"
"os/exec"
"strings"
"github.com/google/shlex"
"github.com/lzh-1625/go_process_manager/config"
"github.com/lzh-1625/go_process_manager/internal/app/constants"
@@ -133,7 +134,7 @@ func (p *ProcessStd) Read() string {
func NewProcessStd(pconfig model.Process) *ProcessBase {
p := ProcessBase{
Name: pconfig.Name,
StartCommand: strings.Split(pconfig.Cmd, " "),
StartCommand: utils.UnwarpIgnore(shlex.Split(pconfig.Cmd)),
WorkDir: pconfig.Cwd,
}
processStd := ProcessStd{