Leaving it running
A run does not need your terminal. Close the window, lose the ssh connection, or /exit and press Detach and exit: the flow goes on taking its turns. Run hmz in the same directory and you are back in it.
At a glance
- You will walk away from a long run and come back to it later, from the same terminal or another one.
- Use it when a run will take longer than you want to sit and watch it, or your connection to the machine may drop.
- You need a flow running in
hmz, started as in Your first run.
Try it
While a flow runs, type /exit, press Detach and exit, and later, in the same directory:
hmzHow it works
The run is not held by the hmz you are looking at. It is held on this machine, apart from the terminal, one run per directory, and hmz is a window onto it. Closing the window, on purpose or because the connection dropped, leaves the run where it was. Running hmz again in the same directory opens a new window onto the same run, and reads it from the top.
That has three consequences:
- One run per directory.
hmzin a directory always opens that directory's run. Another project has its own. - Several windows at once. A second terminal, or an ssh session from elsewhere, can open the same run while you still have it open. Each is a whole interface of its own. See Several people on one run.
- The run lives on this machine. Your laptop can close; the machine running
hmzcannot. A reboot ends the run.
Example: detach, then come back
Start a flow, as in Your first run. Then type /exit, or press ctrl+q, which asks the same thing:
╭────────────────────────────────────────────────────────────────╮ │ │ │ A flow is running. │ │ Detached, it keeps running: run `hmz` here to reattach. │ │ │ │ Stop the flow and exit Detach and exit │ │ │ │ enter stop esc stay │ │ │ ╰────────────────────────────────────────────────────────────────╯
Stop the flow and exit has the focus as the box opens. Press → to move to Detach and exit, then enter, or click it. Your shell comes back, and the flow is still going.
Later, from any terminal on the same machine:
cd ~/tmp/humanize-demo
hmzA new interface on the same run, read from the top. Everything the run did while you were away is here.
What to look at, by number:
- Your task, marked
· by you@tui. The new window reads the run from its first line, so everything said to it is there. A line typed in another window, the one you left included, is marked with who typed it. - The rounds you missed. A Ralph loop kept opening a conversation a round. Here it is on its second, and the first one's work is above it.
- The status line. Still running, with the clock of the turn in progress, and
ctrl+c stopas the last key: this window can stop the run as well as the one you left.
Check it worked
- After Detach and exit, the shell prompt comes back at once, with no
stoppingline. hmzin the same directory reads the flow, still working, from its start.- The transcript holds turns that happened while you were gone.
Before you walk away
- Say you are away. A flow that asks you something waits for an answer. Type
/afk onbefore you go, and it is answered with nothing instead: away stays said after you have left. A role you claimed is anybody's to answer once you leave. See Being away. - Give it a budget you can live with. Nobody is watching the spend. See Every run has a budget.
- Know how to stop it later. Open it with
hmz, then press ctrl+c twice or type/stop. That stops it for everybody reading it. ctrl+c never leaves a run behind. See Stopping.
Variations
- Just close the window. Closing the terminal or losing the connection does what Detach and exit does.
/exitonly asks so that you choose on purpose. - Watch from two places. Leave one
hmzopen and run another in the same directory, over ssh for example. Leaving one leaves the others reading it. - Nobody watching at all. A run with no one at any window belongs on a command line: see Run it unattended.
Troubleshooting
hmz opened on an idle prompt, not on my run
You are in another directory. A run belongs to the directory it was started in: cd there and run hmz again.
The run was gone when I came back
The machine was restarted, or the run ended by itself: its budget was spent, or the flow finished. /epics lists it with how it ended. A flow that can be picked up carries on with /resume; see Picking a run up.
It was waiting for me the whole time
A question was put to you and nobody answered. Turn /afk on before you leave.
hmz: the daemon cannot be reached: …
hmz always holds its runs through this machine's daemon, starting it where none runs, and could not reach or start it; the reason follows the colon. hmz does not open without it. Fix what the reason names and run hmz again.
Next steps
- Being away (
/afk): keep a run you left from waiting on you. - Stopping: end it when you are back.
- Picking a run up: carry on after a reboot or a stop.
- The terminal can leave: how a run outlives its terminal, drawn.
- Daemon reference: the details.