mirror of
https://github.com/saily/vnc-recorder.git
synced 2025-09-04 14:24:40 +00:00
fixing file close problems
This commit is contained in:
4
main.go
4
main.go
@@ -342,19 +342,21 @@ func recorder(c *cli.Context) error {
|
|||||||
logrus.Error("os.Open", err)
|
logrus.Error("os.Open", err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
defer file.Close()
|
|
||||||
|
|
||||||
fileStat, err := file.Stat()
|
fileStat, err := file.Stat()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logrus.Error("fileStat", err)
|
logrus.Error("fileStat", err)
|
||||||
|
file.Close()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
uploadInfo, err := minioClient.PutObject(context.Background(), c.String("s3_bucketName"), outfileName + ".mp4", file, fileStat.Size(), minio.PutObjectOptions{ContentType:"application/octet-stream"})
|
uploadInfo, err := minioClient.PutObject(context.Background(), c.String("s3_bucketName"), outfileName + ".mp4", file, fileStat.Size(), minio.PutObjectOptions{ContentType:"application/octet-stream"})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logrus.Error("minioClient.PutObject", err)
|
logrus.Error("minioClient.PutObject", err)
|
||||||
|
file.Close()
|
||||||
return
|
return
|
||||||
} else {
|
} else {
|
||||||
|
file.Close()
|
||||||
os.Remove(outfileName + ".mp4")
|
os.Remove(outfileName + ".mp4")
|
||||||
}
|
}
|
||||||
logrus.Debug("Successfully uploaded bytes: ", uploadInfo)
|
logrus.Debug("Successfully uploaded bytes: ", uploadInfo)
|
||||||
|
Reference in New Issue
Block a user