Acme Process Management

Feb 12, 2019 06:41 · 407 words · 2 minute read

TL;DR

  • Acme can start long running processes and manage them internally
  • Acme can start a shell
  • Acme-started processes can be terminated

Maneuvering the Middle Mouse Button

Here’s an excerpt from the Acme manual:

       If the text indicated with button 2 is not a recognized built-in, it is
       executed as a shell command.  For example, indicating date with  button
       2 runs date(1).  The standard and error outputs of commands are sent to
       the error window associated with the directory from which  the  command
       was  run, which will be created if necessary.  For example, in a window
       /etc/passwd executing pwd will produce the output /etc in  a  (possibly
       newly-created)  window  labelled  /etc/+Errors.

This is super useful stuff. Consider for a moment le moi writing a blog post using Hugo, which I’m doing at this very moment! Mind-blowing, I know! I can just start a local Hugo server and see the output of its refreshes in another window. See in the following example:

So to unpack what just happened here: I plop a command in the tag line of the directory /Users/otremblay/blog (which is where my blog is), and once I select it, I middle-click the command, which starts a process. All the output of the process is gathered on the right in a new window, which is <directory/of/the/command>/+Errors. Notice at the end, I right-click the link that appeared in the +Errors, and it pops up directly in my browser. USEFUL. I, for one, love it.

Piping selected content to another command

You might have noticed in the previous example, I have a lingering selection in my article’s window: |fmt. I keep that around for long lines, which is my main (arguably illegitimate) concern when typing out the blog posts. I can just select text in the window and the |<command> will replace the content of the selection with the output of the command. See here:

Kill long-running processes

If you go back to the first video, you’ll notice that running the hugo serve command added hugo to the topmost tag, at the very left (literally the topmost leftmost thing in Acme). If you prepend Kill to that, so that it reads Kill hugo, and execute that, it will stop the process. Just in case you were wondering. The process will also die if you exit Acme so that’s another way to kill it.