extending uiop/run-program

Elias Pipping pipping.elias at icloud.com
Wed Aug 10 09:53:41 UTC 2016


> On 01 Aug 2016, at 04:25, Robert Goldman <rpgoldman at sift.net> wrote:
> 
> Elias,
> 
> If you were to move your work on uiop:run-program to a long-lived topic
> branch, I could test it on a wide variety of implementations on Mac and
> Linux.

Dear Robert, dear Faré, dear list,

an update might be in order. Currently, the run-program branch, available from

  (dynamic) https://gitlab.common-lisp.net/epipping/asdf/commits/run-program
  (static) https://gitlab.common-lisp.net/epipping/asdf/commits/a45e91e81d2e973d1541adbe37e81c242ce98c66

has 7 commits over the master branch, each of which should be uncontroversial and either fix a bug or do other kinds of non-invasive cleanup.

Then there’s the run-program-messy-with-rebasing branch

(dynamic) https://gitlab.common-lisp.net/epipping/asdf/commits/run-program-messy-with-rebasing
(static) https://gitlab.common-lisp.net/epipping/asdf/commits/61654b62b2d8cf6265ef968919fe35e9673e0c61

which has additional commits that are more controversial. I’m writing this email mostly because of these controversial commits because I know too little about good design of CL libraries and would like to invite feedback.

I’d like to ask the following questions:

Issue #1:

For CL platforms other than Allegro CL, you can inquire about the exit code of a program repeatedly once it has exited (through %wait-process-result). For Allegro CL, this is not the case: The exit-code will only be returned once. Since the plist that currently makes up a process can store the exit code, that need not be a problem: The first time it is obtained, it could be stored, and repeated calls to %wait-process-result would just hand out the value that’s been stored earlier. To keep the user from having to write code like

  (setf process-info (%wait-process-result process-info))

I used

  (nconc process-info (list :exit-code exit-code))

in https://gitlab.common-lisp.net/epipping/asdf/commit/ac2d610d77806896bc0f1543bcb8f5076b3b21c9. That might be surprising to the user and go against relevant style guides (it’s safe in %wait-process-result in the sense that the entire body is guarded by a non-null-check for :process so that in particular, process-info isn’t NIL). So maybe this should be fixed in a different manner (please note that the issue is not easily settled by documenting that %wait-process-result should only be called once: A function that queries the process status without waiting would call the same function as %wait-process-result for Allegro CL).

Issue #2:

https://gitlab.common-lisp.net/epipping/asdf/commit/1680d3e36a54717b195f672b6996fcae08d54218 and https://gitlab.common-lisp.net/epipping/asdf/commit/4b884915c4d62f07cec53e9d130ab3b99c6bb6e4 add a pair of functions, each.

The former adds %terminate-process (meant to be public) and %posix-process-send-signal (not necessarily public).
The latter adds %process-alive-p (meant to be public) and %process-status-result (not necessarily public).

Are these names and interfaces acceptable? (Now that I’m writing this, I already feel that %process-status-result should probably rather be named %process-status). It also uses nconc in the same way except without the non-null check (this shall be fixed).

Issue #3:

https://gitlab.common-lisp.net/epipping/asdf/commit/308faabe755d718f7fb8f2723d3615a64d50c44f adds getters for the streams contained in a process-info plist. Are these acceptable?

Issue #4:

%run-program uses asserts in quite a few places. These guard against combinations of parameters that are not supported by certain platforms. They do not provide restarts or helpful diagnostics, however. So I’m wondering if they should be replaced by different failure signalling approaches. Or if they should be removed if the underlying platform provides sufficient error handling.

Issue #5:

To extend the failure signalling approaches mentioned above to additional cases, I’ve found it necessary to check if a stream has a file handle.

  https://gitlab.common-lisp.net/epipping/asdf/commit/4628f3fb57384c8d1d62aeacb244eab9e8f978c7

thus adds 

   (defun file-stream-p (stream) …)
   (defun file-stream-or-synonym-p (stream) …)

as exported functions to uiop/stream. Are these names and interfaces acceptable?


Elias

PS: Let me know if you prefer merge requests to such emails.
PPS: I’m currently testing with the following platforms:

acl-10.0-linux-x86 (+the latest updates)
ccl-1.11-f96-linux-x64
clisp-2.49+-unix-x64
cmu-21a__21a_unicode_-linux-x86
ecl-16.1.2-af65969c-linux-x64
lw-7.0.0-linux-x64
mkcl-1.1.10-linux-x64 (git revision c69d5fc907409803fab184ac56bb42041d42c5e4)
sbcl-1.3.8-linux-x64


More information about the asdf-devel mailing list