deno_task_shell icon indicating copy to clipboard operation
deno_task_shell copied to clipboard

Support `wait` command to wait for all async commands.

Open Icelk opened this issue 3 years ago • 4 comments

Support the wait keyword like bash&sh does to allow waiting for async commands to complete. That way, you can run commands in parallel and wait for all to finish before the task quits.

Or does the task just not exit if not all of the async commands are completed? The the manual should maybe be updated?

Icelk avatar Jun 21 '22 15:06 Icelk

Or does the task just not exit if not all of the async commands are completed?

The task exits when all the async commands have completed. What would be nice is a way to return a non-zero exit code if one of the async commands fails. I'm not sure the best way to do that... maybe with wait?

dsherret avatar Jun 21 '22 15:06 dsherret

I agree, it would make sense if wait passed the exit code, but without wait, the task ignores the exit code(s).

Icelk avatar Jun 21 '22 16:06 Icelk

I wonder if by default it should not ignore the exit codes for async commands. So if you do:

cmd1 & cmd2 & cmd3

The exit code would be cmd3's if non-zero, then either cmd1 or cmd2 if non-zero.

To override, someone could do:

cmd1 || exit 0 & cmd 2 || exit 0 & cmd3

I wonder though if this should kill the other commands on the first non-zero exit code or if it should wait for them to complete.

dsherret avatar Jun 21 '22 17:06 dsherret

That seems like a good default.

Icelk avatar Jun 22 '22 19:06 Icelk