stumpwm-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[STUMP] [PATCH] Visual feedback if the shell couldn't execute a command


From: David Hansen
Subject: [STUMP] [PATCH] Visual feedback if the shell couldn't execute a command (SBCL only).
Date: Sat, 26 Apr 2008 23:40:51 +0200
User-agent: Gnus/5.110009 (No Gnus v0.9) Emacs/23.0.60 (gnu/linux)

Hello,

this `message's "Command not found" if the shell exits with exit code
127 (works fine for bash, no idea if that is standard sh).

David

diff --git a/user.lisp b/user.lisp
index 6a0b347..b45cf2d 100644
--- a/user.lisp
+++ b/user.lisp
@@ -571,7 +571,16 @@ careful. If the shell command doesn't return, it will hang 
StumpWM. In
 such a case, kill the shell command to resume StumpWM."
   (if collect-output-p
       (run-prog-collect-output *shell-program* "-c" cmd)
-      (run-prog *shell-program* :args (list "-c" cmd) :wait nil)))
+      (run-prog *shell-program*
+                :args (list "-c" cmd)
+                :wait nil
+                #+sbcl :status-hook
+                #+sbcl #'(lambda (process)
+                           ;; Bash returns with exit code 127 on "command not
+                           ;; found".  XXX: Is this sh or a bash extension?
+                           (and (not (sb-ext:process-alive-p process))
+                                (eq 127 (sb-ext:process-exit-code process))
+                                (message "Command not found: ~a" cmd))))))
 
 (defcommand-alias exec run-shell-command)
 

reply via email to

[Prev in Thread] Current Thread [Next in Thread]