Skip to content

Commit 18819ad

Browse files
committed
fileManagedTask: report changes 'length' N bytes written
1 parent 89a5be7 commit 18819ad

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

tasks/fileManagedTask.go

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,9 @@ type FileManagedTaskExecutor struct {
203203

204204
func (fmte *FileManagedTaskExecutor) Execute(ctx context.Context, task Task) ExecutionResult {
205205
logrus.Debugf("will trigger '%s' task", task.GetPath())
206-
execRes := ExecutionResult{}
206+
execRes := ExecutionResult{
207+
Changes: make(map[string]string),
208+
}
207209

208210
fileManagedTask, ok := task.(*FileManagedTask)
209211
if !ok {
@@ -262,6 +264,14 @@ func (fmte *FileManagedTaskExecutor) Execute(ctx context.Context, task Task) Exe
262264
return execRes
263265
}
264266
fileManagedTask.Updated = true
267+
268+
info, err := fmte.FsManager.Stat(fileManagedTask.Name)
269+
if err != nil {
270+
execRes.Err = err
271+
return execRes
272+
}
273+
274+
execRes.Changes["length"] = fmt.Sprintf("%d bytes written", info.Size())
265275
}
266276
err = fmte.applyFileAttributesToTarget(fileManagedTask)
267277
if err != nil {

0 commit comments

Comments
 (0)