ela
Contents

ManualAgents

Jobs: run and wait

In the terminalela --spec jobs-run-and-wait

A command on a line of its own runs now, in order: the next line starts when it has ended. run is only for doing several things at the same time.

These two start at once, and the commit races the add for git's index.lock:

run git add notes.mdrun git commit -m "notes"

As two plain lines, the commit starts when the add has ended:

git add notes.mdgit commit -m "notes"

A script waits for its own work with run and wait. Nothing polls for a process by its name, and no loop sleeps until something is done.

ela <<'EOF'build = run make buildtests = run make testwait [$build, $tests]echo "both done"EOF
  • run starts a job and gives it to a variable.
  • wait returns when the jobs have ended, and prints their output.
  • A failed job stops the script at the wait.
  • kill $build ends a job; kill pid(4242) sends a signal to another process. A bare number to kill in a script is an error, since it may be a process or a job.

(ela --spec jobs, ela --spec wait, ela --spec kill)