Skip to content
This repository has been archived by the owner on May 27, 2024. It is now read-only.

Commit

Permalink
handle multiline pm path packagename output
Browse files Browse the repository at this point in the history
  • Loading branch information
mastrolube authored and codeskyblue committed Apr 7, 2024
1 parent 8b75d48 commit 5ca740e
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,12 @@ type PackageInfo struct {

func readPackageInfo(packageName string) (info PackageInfo, err error) {
outbyte, err := runShell("pm", "path", packageName)
output := strings.TrimSpace(string(outbyte))
lines := strings.Split(string(outbyte), "\n")
if len(lines) == 0 {
err = errors.New("no output received")
return
}
output := strings.TrimSpace(lines[0])
if !strings.HasPrefix(output, "package:") {
err = errors.New("package " + strconv.Quote(packageName) + " not found")
return
Expand Down

0 comments on commit 5ca740e

Please sign in to comment.