diff options
author | Luke Shumaker <lukeshu@lukeshu.com> | 2022-12-24 23:49:01 -0700 |
---|---|---|
committer | Luke Shumaker <lukeshu@lukeshu.com> | 2022-12-26 23:55:42 -0700 |
commit | a90e25a1298602c30d0b9cc0c86acede7c8e4ed4 (patch) | |
tree | ef980f2d278e373bd7331f56299bfe34b87e8d8a /cmd/btrfs-rec/inspect_lsfiles.go | |
parent | 92b20f73e93a6a08030ad6100ca70d4c9668537e (diff) |
tree-wide: Outlaw fmt.Print, force textui
Diffstat (limited to 'cmd/btrfs-rec/inspect_lsfiles.go')
-rw-r--r-- | cmd/btrfs-rec/inspect_lsfiles.go | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/cmd/btrfs-rec/inspect_lsfiles.go b/cmd/btrfs-rec/inspect_lsfiles.go index 9267f77..801da5d 100644 --- a/cmd/btrfs-rec/inspect_lsfiles.go +++ b/cmd/btrfs-rec/inspect_lsfiles.go @@ -22,6 +22,7 @@ import ( "git.lukeshu.com/btrfs-progs-ng/lib/btrfs/btrfsprim" "git.lukeshu.com/btrfs-progs-ng/lib/btrfsprogs/btrfsutil" "git.lukeshu.com/btrfs-progs-ng/lib/maps" + "git.lukeshu.com/btrfs-progs-ng/lib/textui" ) func init() { @@ -32,20 +33,20 @@ func init() { Args: cliutil.WrapPositionalArgs(cobra.NoArgs), }, RunE: func(fs *btrfs.FS, cmd *cobra.Command, _ []string) (err error) { + out := bufio.NewWriter(os.Stdout) + defer out.Flush() defer func() { if r := derror.PanicToError(recover()); r != nil { - fmt.Printf("\n\n%+v\n", r) + textui.Fprintf(out, "\n\n%+v\n", r) err = fmt.Errorf("panicked") } }() ctx := cmd.Context() - out := bufio.NewWriter(os.Stdout) printSubvol(out, "", true, "/", &btrfs.Subvolume{ FS: btrfsutil.NewBrokenTrees(ctx, fs), TreeID: btrfsprim.FS_TREE_OBJECTID, }) - out.Flush() return nil }, |