Skip to content
This repository was archived by the owner on Jun 16, 2026. It is now read-only.

Commit a64a773

Browse files
committed
status: prevent JSON unmarshal errors on empty status
Signed-off-by: Dorin Geman <dorin.geman@docker.com>
1 parent 99fe714 commit a64a773

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

commands/status.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,13 @@ func newStatusCmd() *cobra.Command {
2626
return handleClientError(status.Error, "Failed to get Docker Model Runner status")
2727
}
2828

29+
if len(status.Status) == 0 {
30+
status.Status = []byte("{}")
31+
}
32+
2933
var backendStatus map[string]string
3034
if err := json.Unmarshal(status.Status, &backendStatus); err != nil {
31-
cmd.PrintErrln(string(status.Status))
35+
cmd.PrintErrln(fmt.Errorf("failed to parse status response: %w", err))
3236
}
3337

3438
if formatJson {

0 commit comments

Comments
 (0)