added command execution via !

This commit is contained in:
Luxferre
2026-08-15 16:58:25 +03:00
parent 4b55c27fee
commit 4509851243
3 changed files with 41 additions and 4 deletions
+16
View File
@@ -1589,5 +1589,21 @@ func TestRenderMDNoColorFallback(t *testing.T) {
}
}
func TestDirectShellExecution(t *testing.T) {
cmd := "echo direct_exec_test"
res := shell(cmd, 10)
if !strings.HasPrefix(res, "direct_exec_test") || !strings.Contains(res, "exit: 0") {
t.Errorf("direct shell exec failed, got %q", res)
}
// Verify that command stripping preserves arguments
u := "! echo hello world"
stripped := strings.TrimSpace(strings.TrimPrefix(u, "!"))
if stripped != "echo hello world" {
t.Errorf("stripped command = %q, want %q", stripped, "echo hello world")
}
}