tests: harden macOS REPL PTY acceptance
This commit is contained in:
parent
0902a9e173
commit
40da07538a
|
|
@ -289,12 +289,25 @@ fn m6_5_ctrl_c_sends_sigint() {
|
||||||
r#"
|
r#"
|
||||||
_G.h = pmacs.repl.spawn { argv = { "cat" } }
|
_G.h = pmacs.repl.spawn { argv = { "cat" } }
|
||||||
_G.sigint_sent = false
|
_G.sigint_sent = false
|
||||||
|
_G.first_seen_running_at = nil
|
||||||
"#,
|
"#,
|
||||||
r#"
|
r#"
|
||||||
local h = _G.h
|
local h = _G.h
|
||||||
if not _G.sigint_sent then
|
if not _G.sigint_sent then
|
||||||
local status = pmacs.process.status(h._proc_id)
|
local status = pmacs.process.status(h._proc_id)
|
||||||
if status and status.kind == "running" then
|
if status and status.kind == "running" then
|
||||||
|
-- Running means the PTY child has been spawned, not
|
||||||
|
-- that the raw-mode /bin/sh trampoline has necessarily
|
||||||
|
-- completed stty + exec. macOS runners can observe that
|
||||||
|
-- gap; wait briefly so SIGINT targets cat, not the
|
||||||
|
-- setup shell.
|
||||||
|
if _G.first_seen_running_at == nil then
|
||||||
|
_G.first_seen_running_at = pmacs.now_ms()
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
if pmacs.now_ms() - _G.first_seen_running_at < 100 then
|
||||||
|
return false
|
||||||
|
end
|
||||||
pmacs.command.invoke("pmacs.repl.send-sigint-current")
|
pmacs.command.invoke("pmacs.repl.send-sigint-current")
|
||||||
_G.sigint_sent = true
|
_G.sigint_sent = true
|
||||||
end
|
end
|
||||||
|
|
@ -325,7 +338,10 @@ fn m6_5_exit_marker_uses_basename_with_leading_newline() {
|
||||||
-- Marker starts with "\n[false exited with code 1]\n".
|
-- Marker starts with "\n[false exited with code 1]\n".
|
||||||
return history:find("\n[false exited with code 1]\n", 1, true) ~= nil
|
return history:find("\n[false exited with code 1]\n", 1, true) ~= nil
|
||||||
"#,
|
"#,
|
||||||
3000,
|
// PTY shutdown publishes the exit event only after a bounded
|
||||||
|
// final-output drain. macOS runners can spend most of the old
|
||||||
|
// 3s budget in spawn + that drain, even for /bin/false.
|
||||||
|
10_000,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue