Skip to content

Commit d1aba19

Browse files
committed
make it even simpler
1 parent 71a81d5 commit d1aba19

File tree

1 file changed

+5
-20
lines changed

1 file changed

+5
-20
lines changed

input/pipewire/pipewire.go

Lines changed: 5 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -119,12 +119,7 @@ func NewSession(cfg input.SessionConfig) (*Session, error) {
119119

120120
// pw-cat 1.4.0 introduces explicit stdout support, needs --raw arg
121121
// see https://gitlab.freedesktop.org/pipewire/pipewire/-/issues/4629#top
122-
useRawArg, err := checkNeedRawArg()
123-
if err != nil {
124-
return nil, errors.Wrap(err, "failed to check need of pipewire '--raw' arg")
125-
}
126-
127-
if useRawArg {
122+
if checkNeedRawArg() {
128123
args = append(args, "--raw")
129124
}
130125

@@ -310,22 +305,12 @@ func shortEpoch() string {
310305
return base64.RawURLEncoding.EncodeToString(buf[:])
311306
}
312307

313-
func checkNeedRawArg() (bool, error) {
314-
cmd := exec.Command("pw-cat", "--help")
315-
316-
out, err := cmd.Output()
308+
func checkNeedRawArg() bool {
309+
out, err := exec.Command("pw-cat", "--help").Output()
317310

318311
if err != nil {
319-
return false, err
320-
}
321-
322-
lines := strings.Split(string(out), "\n")
323-
324-
for _, line := range lines {
325-
if strings.Contains(line, "--raw") {
326-
return true, nil
327-
}
312+
panic(err)
328313
}
329314

330-
return false, nil
315+
return strings.Contains(string(out), "--raw")
331316
}

0 commit comments

Comments
 (0)