Skip to content

Commit

Permalink
fix unit tests
Browse files Browse the repository at this point in the history
Signed-off-by: Gyuho Lee <[email protected]>
  • Loading branch information
gyuho committed Dec 31, 2024
1 parent 1eb4c15 commit ecac8b4
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions pkg/disk/lsblk.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,21 +88,24 @@ func decideLsblkFlag(ctx context.Context) (string, func([]byte, ...OpOption) (Bl
return "", nil, err
}

var lsblkCmd string
var parser func([]byte, ...OpOption) (BlockDevices, error)
lines := make([]string, 0)
if err := process.Read(
ctx,
p,
process.WithReadStdout(),
process.WithReadStderr(),
process.WithProcessLine(func(line string) {
lsblkCmd, parser = decideLsblkFlagAndParserFromVersion(line)
lines = append(lines, line)
}),
process.WithWaitForCmd(),
); err != nil {
return "", nil, fmt.Errorf("failed to check lsblk version: %w", err)
}

line := strings.Join(lines, "\n")
line = strings.TrimSpace(line)

lsblkCmd, parser := decideLsblkFlagAndParserFromVersion(line)
return lsblkCmd, parser, nil
}

Expand Down

0 comments on commit ecac8b4

Please sign in to comment.