-
-
Notifications
You must be signed in to change notification settings - Fork 646
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ensure cider-jack-in fails gracefully when commands are not found #1733
Ensure cider-jack-in fails gracefully when commands are not found #1733
Conversation
I like this solution. IIRC, there are situations in which the exec-path might get set after our defcustom is defined, so it's a good idea to have a sane fallback. |
Is there the same problem with |
Btw, I guess you've seen the code here, right - https://github.com/clojure-emacs/cider/blob/master/cider.el#L497 |
@bbatsov I don't think lein is affected. lein and gradle are defined as literal values, whereas boot is subject to change due to invoking
The nil value of This fix adds a default fallback literal value so that if |
I get what the fix does. I simply dislike we're doing different things for |
@@ -110,7 +110,8 @@ version from the CIDER package or library.") | |||
|
|||
(defcustom cider-boot-command | |||
(or (executable-find "boot") | |||
(executable-find "boot.sh")) | |||
(executable-find "boot.sh") | |||
"boot") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we do something like this the first check would be redundant. As I mentioned earlier - I'd rather simplify this to be just a constant to keep in aligned with other similar values.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If not searching for "boot.sh", then there's no need to search for "boot" at this point either. Simply setting "boot" should be enough as executable-find
is called later with this value. However, I note that cider--{cmd}-present-p
and cider-jack-in-command
actually do different things to locate an executable — this seems like a bug.
Ok. I'm with changing it to just boot. |
One more thing - the real place to fix the bug is the place where a nil can be passed to |
I agree with changing the value to just "boot", and let "boot.sh" users simply customize the variable, instead of magically nesting I'm not sure if the main code path needs to protect itself against such nils. It seems like a reasonable assumption that a custom variable is non-nil, given that it is typed |
Fine. Let's just change the default and wrap this. On Thursday, 5 May 2016, Abhishek Reddy notifications@github.com wrote:
Best Regards, |
…ns and slightly refactor cider-jack-in
Here's a somewhat bigger change to normalize behaviour between the present-p check and the command search code paths. This allows custom variables for |
("lein" (cider--lein-resolve-command)) | ||
("boot" (cider--boot-resolve-command)) | ||
("gradle" (cider--gradle-resolve-command)) | ||
(_ (error "Unsupported project type `%s'" project-type)))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
user-error
Problem: Running
cider-jack-in
with a Boot project whenboot
orboot.sh
is not found inexec-path
yields an error like this:Expected: a more user-friendly message like this:
The boot executable (specified by
cider-lein-command' orcider-boot-command') isn't on your
exec-path'`The source of the bug seems to be that
cider-boot-command
can be nil since it has a non-literal value, whereascider--boot-present-p
assumes it is non-nil. I've added a fallback literal value"boot"
to guard against this causing problems.Affects cider-20160501.1921 (melpa) and git master.
Before submitting a PR make sure the following things have been done (and denote this
by checking the relevant checkboxes):
make test
)M-x checkdoc
warnings