Skip to content

Commit

Permalink
fix output
Browse files Browse the repository at this point in the history
  • Loading branch information
mostlikelee committed Nov 10, 2024
1 parent ad557c6 commit 188a074
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
5 changes: 2 additions & 3 deletions orbit/pkg/zenity/zenity.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,7 @@ func (z *Zenity) ShowInfo(ctx context.Context, opts InfoOptions) error {

func execCmd(ctx context.Context, args ...string) ([]byte, int, error) {
cmd := exec.CommandContext(ctx, "zenity", args...)
fmt.Println(cmd.String())
err := cmd.Run()
output, err := cmd.CombinedOutput()
if err != nil {
var exitCode int // exit 0 ok here if zenity returns an error
if cmd.ProcessState != nil {
Expand All @@ -125,5 +124,5 @@ func execCmd(ctx context.Context, args ...string) ([]byte, int, error) {
return nil, exitCode, err
}

return nil, cmd.ProcessState.ExitCode(), nil
return output, cmd.ProcessState.ExitCode(), nil
}
4 changes: 2 additions & 2 deletions tools/zenity/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ func main() {
Title: "Zenity Test Entry Title",
Text: "Zenity Test Entry Text",
HideText: true,
TimeOut: 5 * time.Second,
TimeOut: 10 * time.Second,
})
if err != nil {
fmt.Println("Err ShowEntry")
Expand All @@ -26,7 +26,7 @@ func main() {
err = prompt.ShowInfo(ctx, zenity.InfoOptions{
Title: "Zenity Test Info Title",
Text: "Result: " + string(output),
TimeOut: 5 * time.Second,
TimeOut: 10 * time.Second,
})
if err != nil {
fmt.Println("Err ShowInfo")
Expand Down

0 comments on commit 188a074

Please sign in to comment.