refactor: save screenshot in async

This commit is contained in:
lilong.129
2025-03-05 16:29:36 +08:00
parent 98d1ecb478
commit e187ba824a
7 changed files with 49 additions and 90 deletions
-12
View File
@@ -237,18 +237,6 @@ func (hd *HDCDriver) ScreenShot(opts ...option.ActionOption) (*bytes.Buffer, err
return nil, err
}
rawBuffer := bytes.NewBuffer(raw)
actionOptions := option.NewActionOptions(opts...)
if actionOptions.ScreenShotFileName != "" {
// save screenshot to file
path, err := saveScreenShot(rawBuffer, actionOptions.ScreenShotFileName)
if err != nil {
return nil, errors.Wrapf(code.DeviceScreenShotError,
"save screenshot file failed %v", err)
}
log.Info().Str("path", path).Msg("screenshot saved")
}
return rawBuffer, nil
}