update uses of "when" in base scripts to include captures

This commit is contained in:
Vern Paxson 2022-01-07 14:53:33 -08:00
parent f895008c34
commit 98cd3f2213
15 changed files with 21 additions and 21 deletions

View file

@ -98,7 +98,7 @@ function request(req: Request): ActiveHTTP::Response
local cmd = request2curl(req, bodyfile, headersfile);
local stdin_data = req?$client_data ? req$client_data : "";
return when ( local result = Exec::run([$cmd=cmd, $stdin=stdin_data, $read_files=set(bodyfile, headersfile)]) )
return when [req, resp, cmd, stdin_data, bodyfile, headersfile] ( local result = Exec::run([$cmd=cmd, $stdin=stdin_data, $read_files=set(bodyfile, headersfile)]) )
{
# If there is no response line then nothing else will work either.
if ( ! (result?$files && headersfile in result$files) )

View file

@ -28,7 +28,7 @@ event Dir::monitor_ev(dir: string, last_files: set[string],
callback: function(fname: string),
poll_interval: interval)
{
when ( local result = Exec::run([$cmd=fmt("ls -1 %s/", safe_shell_quote(dir))]) )
when [dir, last_files, callback, poll_interval] ( local result = Exec::run([$cmd=fmt("ls -1 %s/", safe_shell_quote(dir))]) )
{
if ( result$exit_code != 0 )
{

View file

@ -178,7 +178,7 @@ function run(cmd: Command): Result
$want_record=F,
$config=config_strings]);
return when ( cmd$uid !in pending_commands )
return when [cmd] ( cmd$uid !in pending_commands )
{
local result = results[cmd$uid];
delete results[cmd$uid];