@@ -49,6 +49,25 @@ func NewFilesystemDataSource() (*FilesystemDataSource, error) {
4949 }
5050 var imageInfo ImageInfo
5151
52+
53+ for {
54+ cmd := exec .CommandContext (ctx , "qemu-img" , "info" , "--output=json" , filesystemImagePath )
55+ rawOut , err := cmd .Output ()
56+ if err != nil {
57+ rawOut , err = cmd .CombinedOutput ()
58+ if err != nil {
59+ fmt .Printf ("inner error running qemu-img info: %w\n " , err )
60+ }
61+ fmt .Printf ("qemu-img command output: %s\n " , string (rawOut ))
62+
63+ fmt .Printf ("error running qemu-img info: %w\n " , err )
64+ }
65+
66+ fmt .Printf ("qemu-img command output: %s\n " , string (rawOut ))
67+
68+ time .Sleep (time .Second )
69+ }
70+
5271 cmd := exec .CommandContext (ctx , "qemu-img" , "info" , "--output=json" , filesystemImagePath )
5372 rawOut , err := cmd .Output ()
5473 if err != nil {
@@ -68,24 +87,6 @@ func NewFilesystemDataSource() (*FilesystemDataSource, error) {
6887 uuid , _ := uuid .NewUUID ()
6988 sourceImageFilename := uuid .String () + ".img"
7089
71- for {
72- cmd := exec .CommandContext (ctx , "qemu-img" , "info" , "--output=json" , filesystemImagePath )
73- rawOut , err := cmd .Output ()
74- if err != nil {
75- rawOut , err = cmd .CombinedOutput ()
76- if err != nil {
77- return nil , fmt .Errorf ("error running qemu-img info: %w" , err )
78- }
79- fmt .Printf ("qemu-img command output: %s\n " , string (rawOut ))
80-
81- return nil , fmt .Errorf ("error running qemu-img info: %w" , err )
82- }
83-
84- fmt .Printf ("qemu-img command output: %s\n " , string (rawOut ))
85-
86- time .Sleep (time .Second )
87- }
88-
8990 return & FilesystemDataSource {
9091 readCloser : file ,
9192 sourceImageSize : int64 (imageInfo .VirtualSize ),
0 commit comments