add interactive flag to cp/mv to avoid overwrite

This commit is contained in:
Gokcehan committed 2017-10-26 18:31:48 +03:00
1 parent 460ccbea4a
commit f907a553ae
1 file changed
+8
+8
View File
@@ -72,6 +72,14 @@ func putCommand(list []string, dir *dir, copy bool) *exec.Cmd {
} else {
sh = "mv"
}
// XXX: POSIX standard states that -i flag shall do nothing when the
// response is not affirmative. Since this command is run with a nil stdin,
// it should not give an affirmative answer and in return this command
// should not overwrite existing files. Our intention here is to use the
// standard -i flag in place of non-standard -n flag to avoid overwrites.
args = append(args, "-i")
args = append(args, list...)
args = append(args, dir.path)