fix: commands on SSH hosts run under sh -c, so hosts whose login shell is csh or tcsh list, zip and send files too

This commit is contained in:
redtea committed 2026-10-16 10:02:10 +03:00
1 parent 458d826de6
commit 6d8f39f2a5
3 files changed
+29 -6

No files matched your search

+15
View File
@@ -225,3 +225,18 @@ func TestListFolderLink(t *testing.T) {
}
}
}
// Commands go to the host as one argument of sh -c, so the user's own login
// shell (fish, csh) cannot read them its way.
func TestPosixCommand(t *testing.T) {
if got := posix(`if [ -d '/x' ]; then echo ok; fi`); got != `sh -c 'if [ -d '\''/x'\'' ]; then echo ok; fi'` {
t.Fatalf("%s", got)
}
}
// csh expands "!" even inside single quotes: it goes out as '\!'.
func TestPosixCommandBang(t *testing.T) {
if got := posix(`ls .[!.]*`); got != `sh -c 'ls .['\!'.]*'` {
t.Fatalf("%s", got)
}
}