sellout/external-program

Feature request: Add a function to wait for processes

Closed this issue · 3 comments

I can already run a program asynchronously (yay!). But then how do I know when it's done? (without resorting to a loop in which I constantly call process-status)

There are mechanisms in place for this kind of task, like sb-ext:process-wait for sbcl. A look at the source of UIOP in https://github.com/fare/asdf/blob/master/uiop/run-program.lisp (where this logic is made available as part of the function %wait-process-result, but not a separate function) suggests that the following should work:

  #+clozure (ccl::external-process-wait process)
  #+(or cmu scl) (ext:process-wait process)
  #+sbcl (sb-ext:process-wait process)

It might be worth mentioning that iolib provided a separate function process-wait at some point but then merged the functionality into process-status and process-activep in ca1bc39f11d42662aafcef87d4d6cc78d53a4f87.

Additionally, ecl has (ext:external-process-wait process t) and mkcl has (mk-ext:join-process process)

Even though uiop/run-program is not yet feature-complete replacement for external-program, it does not make any sense to add new features to external-program at this point anymore.

uiop/run-program::%wait-process-result does a better job than what I was proposing here.