@cryptotaxi247 / kubo / commits / 871cc6f1b

call flush after files rm

License: MIT Signed-off-by: Jeromy <jeromyj@gmail.com>

Jeromy committed Dec 26, 2015 at 17:42 UTC 871cc6f1b166fcef24d1ff09c7ed903ae105ff14
1 file changed +14
core/commands/files/files.go
+14
@@ -659,6 +659,17 @@ remove files or directories
659
660 dashr, _, _ := req.Option("r").Bool()
661
662 + var success bool
663 + defer func() {
664 + if success {
665 + err := pdir.Flush()
666 + if err != nil {
667 + res.SetError(err, cmds.ErrNormal)
668 + return
669 + }
670 + }
671 + }()
672 +
673 // if '-r' specified, don't check file type (in bad scenarios, the block may not exist)
674 if dashr {
675 err := pdir.Unlink(name)
@@ -667,6 +678,7 @@ remove files or directories
678 return
679 }
680
681 + success = true
682 return
683 }
684
@@ -686,6 +698,8 @@ remove files or directories
698 res.SetError(err, cmds.ErrNormal)
699 return
700 }
701 +
702 + success = true
703 }
704 },
705 }