pub fn escape_for_timeout_wrapper(command: &str) -> StringExpand description
Escapes a command for safe inclusion inside single quotes in timeout wrapper
This function escapes characters that would break out of single quotes
when used inside the timeout wrapper: timeout -k 2s 10s sh -lc '{cmd}'
§Arguments
command- The raw command string
§Returns
A safely escaped command string
§Examples
use ssh_mcp::ssh::sanitize::escape_for_timeout_wrapper;
// Simple command
assert_eq!(escape_for_timeout_wrapper("sleep 10"), "sleep 10");
// Command with single quotes
assert_eq!(escape_for_timeout_wrapper("echo 'hello'"), "echo '\"'\"'hello'\"'\"'");
// Command with backslashes
assert_eq!(escape_for_timeout_wrapper(r"echo \$HOME"), r"echo \$HOME");