Skip to content
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

Allow command checkers to specify environment for starting processes #1792

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

doublep
Copy link
Member

@doublep doublep commented May 28, 2020

This simple change adds possibility for command-based checkers to specify environment (i.e. environment variables) in which their processes are started. This is completely optional and not used by any existing checker. I plan to eventually use this functionality in flycheck-eldev. In Eldev it is possible to switch Emacs binary you use, but not as a command line option (command line is parsed by Elisp code, so it's a bit too late), only by modifying an environment variable.

Verified by make check specs unit. Also verified that it actually affects process environment e.g. by using this locally:

:environment (lambda (checker environment) (cons "ELDEV_EMACS=lol" environment))

After this Eldev couldn't launch, as expected.

@CLAassistant
Copy link

CLAassistant commented May 28, 2020

CLA assistant check
All committers have signed the CLA.

@cpitclaudel
Copy link
Member

Thanks, the patch is clean and simple.

However, I'm a bit unsure whether we actually need this, at least just yet, since no other checker makes use of this. It has come up a few times, but never really became needed.

(As to picking an emacs version, what I've done in esh is to use a minimal wrapper that calls an Emacs subprocess according the relevant environment variable, I think)

@doublep
Copy link
Member Author

doublep commented Jun 9, 2020

I'm a bit unsure whether we actually need this, at least just yet, since no other checker makes use of this.

Of course, no checker can make use of something that doesn't exist.

It has come up a few times, but never really became needed.

Aha. But I guess each time a workaround like

what I've done in esh is to use a minimal wrapper that calls an Emacs subprocess

was used instead of a "clean and simple" feature.

@cpitclaudel
Copy link
Member

Of course, no checker can make use of something that doesn't exist.

This is not what I meant. What I mean is that we've never have a case yet where this was really needed, I think.

Aha. But I guess each time a workaround like … was used instead of a "clean and simple" feature.

No, not really, at least not in my memory (esh isn't a Flycheck checker)

Besides,

what I've done in esh is to use a minimal wrapper that calls an Emacs subprocess

Isn't that what you do too? Otherwise, how do you use the environment variable?

@doublep
Copy link
Member Author

doublep commented Jun 10, 2020

Isn't that what you do too? Otherwise, how do you use the environment variable?

Shell script: https://github.com/doublep/eldev/blob/master/bin/eldev

What I want to do is to use the oldest available Emacs binary that is still good enough for the current project (most projects declare which Emacs version they require). This would allow to spot incompatibilities with older Emacsen using Flycheck, e.g. usage of too new functions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants