fix(commander): capture output via CombinedOutput instead of piping streams
Some checks failed
gobuild / build (push) Failing after 7s
Some checks failed
gobuild / build (push) Failing after 7s
- Remove os import and manual Stdin/Stdout/Stderr assignment from subExecute - Replace cmd.Run() followed by cmd.CombinedOutput() with single CombinedOutput call - Adjust volume bar height to exactly match metadata display and increase gap to 2 spaces
This commit is contained in:
parent
c64c80448c
commit
07586a8fc0
@ -2,7 +2,6 @@ package main
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
|
||||||
"os/exec"
|
"os/exec"
|
||||||
"runtime"
|
"runtime"
|
||||||
)
|
)
|
||||||
@ -27,12 +26,9 @@ func isInstalled(name string) bool {
|
|||||||
|
|
||||||
func subExecute(program string, args ...string) ([]byte, error) {
|
func subExecute(program string, args ...string) ([]byte, error) {
|
||||||
cmd := exec.Command(program, args...)
|
cmd := exec.Command(program, args...)
|
||||||
cmd.Stdin = os.Stdin
|
output, err := cmd.CombinedOutput()
|
||||||
cmd.Stdout = os.Stdout
|
|
||||||
cmd.Stderr = os.Stderr
|
|
||||||
err := cmd.Run()
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Printf("%v\n", err)
|
fmt.Printf("%v\n", err)
|
||||||
}
|
}
|
||||||
return cmd.CombinedOutput()
|
return output, err
|
||||||
}
|
}
|
||||||
|
|||||||
@ -480,7 +480,7 @@ func (a *App) renderPlayback() string {
|
|||||||
Padding(1, 2).
|
Padding(1, 2).
|
||||||
Width(boxW)
|
Width(boxW)
|
||||||
|
|
||||||
dispW := min(boxW-10, 50) // leave room for vertical vol bar (~2) + separator
|
dispW := min(boxW-11, 50) // leave room for vertical vol bar (2) + slightly larger gap (2)
|
||||||
display := lipgloss.NewStyle().
|
display := lipgloss.NewStyle().
|
||||||
Background(lipgloss.Color("235")).
|
Background(lipgloss.Color("235")).
|
||||||
Foreground(lipgloss.Color("46")). // classic green lcd
|
Foreground(lipgloss.Color("46")). // classic green lcd
|
||||||
@ -504,10 +504,11 @@ func (a *App) renderPlayback() string {
|
|||||||
|
|
||||||
metadata := display.Render(strings.Join(metaLines, "\n"))
|
metadata := display.Render(strings.Join(metaLines, "\n"))
|
||||||
|
|
||||||
// vertical volume bar to the right of the metadata display
|
// vertical volume bar to the right of the metadata display, matching its exact height
|
||||||
volBar := renderVolumeBar(a.currentVolume, 5, 2)
|
barHeight := lipgloss.Height(metadata)
|
||||||
|
volBar := renderVolumeBar(a.currentVolume, barHeight, 2)
|
||||||
|
|
||||||
// place side-by-side (top aligned). Add a small separator space.
|
// place side-by-side (top aligned). Slightly increased gap.
|
||||||
viewer := lipgloss.JoinHorizontal(lipgloss.Top, metadata, " ", volBar)
|
viewer := lipgloss.JoinHorizontal(lipgloss.Top, metadata, " ", volBar)
|
||||||
|
|
||||||
// button row (text buttons, stateful)
|
// button row (text buttons, stateful)
|
||||||
@ -544,7 +545,7 @@ func min(a, b int) int {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// renderVolumeBar draws a vertical volume indicator bar.
|
// renderVolumeBar draws a vertical volume indicator bar.
|
||||||
// height matches the metadata display (e.g. 5).
|
// height is passed in to exactly match the metadata window's rendered height.
|
||||||
// background is dark gray ("236"), filled indicator uses the green ("46") from the lcd display.
|
// background is dark gray ("236"), filled indicator uses the green ("46") from the lcd display.
|
||||||
func renderVolumeBar(vol int, height, width int) string {
|
func renderVolumeBar(vol int, height, width int) string {
|
||||||
if height <= 0 {
|
if height <= 0 {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user