Skip to content

Commit

Permalink
fix: remove stdout when start
Browse files Browse the repository at this point in the history
  • Loading branch information
siyul-park committed Nov 16, 2024
1 parent ef173c2 commit c66470b
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
10 changes: 10 additions & 0 deletions cmd/pkg/cli/start.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package cli

import (
"io"
"os"
"os/signal"
"syscall"
Expand Down Expand Up @@ -68,6 +69,13 @@ func runStartCommand(config StartConfig) func(cmd *cobra.Command, args []string)
return err
}

out := cmd.OutOrStdout()
if out == os.Stdout {
out = nil
}

cmd.SetOut(io.Discard)

if err := applySpecs(cmd); err != nil {
return err
}
Expand All @@ -78,6 +86,8 @@ func runStartCommand(config StartConfig) func(cmd *cobra.Command, args []string)
return err
}

cmd.SetOut(out)

h := config.Hook
if h == nil {
h = hook.New()
Expand Down
4 changes: 4 additions & 0 deletions pkg/scheme/scheme.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package scheme

import (
"github.com/gofrs/uuid"
"reflect"
"slices"
"sync"
Expand Down Expand Up @@ -151,5 +152,8 @@ func (s *Scheme) Decode(sp spec.Spec) (spec.Spec, error) {
return nil, err
}

if structured.GetID() == uuid.Nil {
structured.SetID(uuid.Must(uuid.NewV7()))
}
return structured, nil
}

0 comments on commit c66470b

Please sign in to comment.