Skip to content

Commit

Permalink
util: lsblk: include command in error string
Browse files Browse the repository at this point in the history
Previously this would return a string that was missing the
command being executed, for example:

"failed to execute `-dno pkname /dev/sda1`: exit status 32"

Now it will return something like the following, which makes
a bit more sense when read:

"failed to execute `lsblk -dno parttype /dev/sda1`: exit status 32"

Signed-off-by: Tim Serong <tserong@suse.com>
  • Loading branch information
tserong authored and Vicente-Cheng committed Jul 17, 2024
1 parent e8a08dc commit fe39ab8
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion pkg/block/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ func lsblk(devPath, output string) (string, error) {
}
out, err := exec.Command(LSBLKCMD, args[0:]...).Output() // #nosec G204
if err != nil {
return "", fmt.Errorf("failed to execute `%s`: %s", strings.Join(args, " "), err.Error())
return "", fmt.Errorf("failed to execute `%s %s`: %s", LSBLKCMD, strings.Join(args, " "), err.Error())
}

return strings.TrimSuffix(string(out), "\n"), nil
Expand Down

0 comments on commit fe39ab8

Please sign in to comment.