added command execution via !
This commit is contained in:
@@ -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")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user