let with_failwith f =
let msg = tmp_file "msg" in
let ret = tmp_file "ret" in
let varname = string "tttttt" in
with_signal
~catch:(seq [
call [string "printf"; string "FAILURE: %s"; msg#get];
setenv varname ret#get;
msg#delete;
ret#delete;
call [string "exit"; getenv varname];
])
(fun throw ->
f (fun ~message ~return ->
seq [
msg#set message;
ret#set (Integer.to_string return);
(* call [string "echo"; pid#get]; *)
(* call [string "ps"; pid#get]; *)
throw;
(* call [string "kill"; string "-s"; string "USR1"; pid#get] *)
]))