@@ -145,31 +145,41 @@ func (tcc *TransferConfigCommand) Run() (err error) {
145145 }
146146
147147 if tcc .interactive {
148- tcc .LogTitle ("Phase 3.5/5 - Modify configuration (press any key to continue...) " )
148+ tcc .LogTitle ("Phase 3.5/5 - Modify configuration interactively " )
149149
150150 // filename := "config_" + time.Now().Format(general.SafeDateFileFormat) + ".zip"
151151 filename := "config_*.zip"
152152
153153 // open output file
154154 fo , err2 := os .CreateTemp ("" , filename )
155155 if err2 != nil {
156+ log .Error ("Failed to create temporary file " , filename , " " , err2 )
156157 return
157158 }
158159
159160 // close fo on exit and check for its returned error
160161 defer func () {
161162 if err := fo .Close (); err != nil {
163+ // log.Error(err)
162164 return
163165 }
164166
165167 err := os .Remove (filename )
166168 if err != nil {
169+ log .Error ("Failed to remove temporary file " , filename , " " , err )
167170 return
168171 }
169172 }()
170173
171174 // write file to disk
172- fo .Write (archiveConfig .Bytes ())
175+ writtenToDisk , err3 := fo .Write (archiveConfig .Bytes ())
176+
177+ if err3 != nil {
178+ log .Error ("Failed to write temporary file " , filename , " " , err3 )
179+ return
180+ }
181+
182+ log .Debug ("Wrote " , writtenToDisk , " bytes " , len (archiveConfig .Bytes ()))
173183 fo .Sync ()
174184
175185 log .Info ("Waiting for you to modify the file:" )
@@ -182,13 +192,14 @@ func (tcc *TransferConfigCommand) Run() (err error) {
182192
183193 // Read file from disk
184194 buf := bytes .NewBuffer (nil )
185- written , err3 := io .Copy (buf , fo )
195+ readFromDisk , err3 := io .Copy (buf , fo )
186196
187197 if err3 != nil {
198+ log .Error ("Failed to read temporary file " , filename , " " , err3 )
188199 return
189200 }
190201
191- log .Debug ("Copied " , written , " bytes " , len (buf .Bytes ()), len (archiveConfig .Bytes ()))
202+ log .Debug ("Read " , readFromDisk , " bytes " , len (buf .Bytes ()), " " , len (archiveConfig .Bytes ()))
192203 archiveConfig = buf
193204 }
194205
0 commit comments