mod common;
use common::call_tool_raw;
use std::time::Duration;
#[tokio::test]
async fn test_exec_drain_bounded_when_pipe_held_open() {
let fut = async {
let resp = call_tool_raw(
"exec_command",
serde_json::json!({
"command": "sh -c 'printf \"line\\n\"; sleep 300'",
"timeout_secs": 30
}),
)
.await;
assert!(
resp["result"]["isError"].as_bool().unwrap_or(false),
"expected tool timeout error from bounded drain timeout: {resp}"
);
};
tokio::time::timeout(Duration::from_secs(35), fut)
.await
.expect("drain did not complete within 35s: the timeout path may still hang");
}