From fb53f6159e629e01f29304138f11c32832f70c58 Mon Sep 17 00:00:00 2001 From: "songyang.song" Date: Fri, 10 Feb 2023 16:01:17 +0800 Subject: [PATCH] fix exec and release build Signed-off-by: songyang.song --- .github/workflows/python-publish.yml | 2 +- publish.yaml | 2 +- saectl/internal/cmd/exec/exec.go | 5 +---- saectl/internal/cmd/exec/stream/stream.go | 25 ----------------------- 4 files changed, 3 insertions(+), 31 deletions(-) diff --git a/.github/workflows/python-publish.yml b/.github/workflows/python-publish.yml index 57e82de..4531767 100644 --- a/.github/workflows/python-publish.yml +++ b/.github/workflows/python-publish.yml @@ -63,7 +63,7 @@ jobs: - uses: actions/setup-node@v1 name: Set up Node with: - node-version: 12 + node-version: 18 - name: Set up Python uses: actions/setup-python@v2 with: diff --git a/publish.yaml b/publish.yaml index cfbbcc2..9360847 100644 --- a/publish.yaml +++ b/publish.yaml @@ -2,7 +2,7 @@ Type: Component Name: sae Provider: - 阿里云 -Version: 1.0.12 +Version: 1.0.13 Description: 阿里云SAE组件 HomePage: https://github.com/devsapp/sae Tags: #标签详情 diff --git a/saectl/internal/cmd/exec/exec.go b/saectl/internal/cmd/exec/exec.go index d8cdbb8..09ed331 100644 --- a/saectl/internal/cmd/exec/exec.go +++ b/saectl/internal/cmd/exec/exec.go @@ -128,10 +128,7 @@ func (o *Options) Run() error { if err != nil { return err } - //_, _ = e.Exec("curl 127.0.0.1:5555") - _, _ = e.Exec("c") - return nil - //return e.Stream() + return e.Stream() } return o.tty.Safe(fn) } diff --git a/saectl/internal/cmd/exec/stream/stream.go b/saectl/internal/cmd/exec/stream/stream.go index e0c51ee..1442fae 100644 --- a/saectl/internal/cmd/exec/stream/stream.go +++ b/saectl/internal/cmd/exec/stream/stream.go @@ -2,7 +2,6 @@ package stream import ( "context" - "fmt" "io" "strings" "sync" @@ -32,30 +31,6 @@ func NewExecutor(conn *websocket.Conn, op Option) *Executor { } } -func (e *Executor) Exec(cmd string) (string, error) { - stop := make(chan struct{}) - ctx, cancel := context.WithCancel(context.Background()) - - go func(ctx context.Context) { - websocket.Message.Send(e.Conn, cmd+"\n") - for i := 1; i <= 2; i++ { - websocket.Message.Send(e.Conn, "exit\n") - } - }(ctx) - - stdOutBuffer := NewStdOutBuffer() - e.copyStdout(stop, stdOutBuffer) - - select { - case <-stop: - cancel() - } - - r := stdOutBuffer.String() - fmt.Println(r) - return r, nil -} - func (e *Executor) Stream() error { stop := make(chan struct{}) ctx, cancel := context.WithCancel(context.Background())