On Wed, Sep 7, 2016 at 3:51 PM, Elias Pipping pipping.elias@icloud.com wrote:
I’ve now tested what happens on OpenBSD rather than Linux. Not entirely unsurprisingly (I simply hadn’t thought about it), it turns out that the difference between (2) and (3), namely the additional shell layer, also enters here:
(defun %normalize-command (command) ... (etypecase command #+os-unix (string `("/bin/sh" "-c" ,command)) #+os-unix (list command) …
In other words: Whether %run-program is passed something like “/bin/something arg” or (list “/bin/something” “arg”) potentially makes a difference; and indeed it does make a difference for (2) (because it can be turned into (3) this way). Again, it’s not surprising that it does, but my impression is that the user really should not have to worry about this difference, otherwise the entire abstraction that %run-program provides breaks down.
That's actually good design, well documented in the top of the run-program docstring. And if you think about it, that's the only sensible thing to do. If you have a different spec to propose as to how the command argument should be interpreted in a way that makes sense portably, I'm all ears. The user SHOULD have to know what he's asking the machine to do. Note that if your shell command starts with exec, it will eschew one intermediate layer of shell while running your subprocess.
So we’re now at a place where distinguishing (:exited 143) and (:signaled 15) may or may not work depending on whether you pass a string or a list, what operating system you're on, what lisp you’re on, and whether you call your script synchronously or asynchronously. I think it’s safe to say we should just give up on this undertaking. Return 143 in both cases. We can do that reliably now and I’m happy that we can. We should not return additional information if it’s not reliable.
I believe that in these cases, it's OK to fall back on "best effort": on implementations that allow, return an extra distinguishing value, and have that value be NIL if you can't tell.
—♯ƒ • François-René ÐVB Rideau •Reflection&Cybernethics• http://fare.tunes.org An excessive knowledge of Marxism is a sign of a misspent youth. — John McCarthy