Skip to content
This repository was archived by the owner on Dec 15, 2022. It is now read-only.
This repository was archived by the owner on Dec 15, 2022. It is now read-only.

pre-commit hook hard-codes path #764

Closed

Description

@kpaulisse

Description

I use a pre-commit hook that runs rubocop via bundler, and suddenly started getting the following error:

.../script/fmt: line 6: bundle: command not found

I inserted a bit of debugging right before that and it looks like PATH for pre-commit hooks is set to:

$HOME/.atom/packages/github/node_modules/dugite/git/libexec/git-core:/usr/bin:/bin:/usr/sbin:/sbin

This worked before (kind of) - if the pre-commit hook passed it would allow the commit, and if the pre-commit hook failed it would silently ignore the error and do nothing. I'm super happy to see the pop-up error, but sad that PATH is not passed through from the environment.

Steps to Reproduce

  1. Create a pre-commit hook that calls a script outside of the aforementioned path
  2. Attempt to commit and see the error

Expected behavior:

pre-commit hook inherits PATH from environment

Actual behavior:

pre-commit hook has hard-coded PATH that cannot be influenced by the environment

Reproduces how often:

100%

Versions

Atom    : 1.16.0
Electron: 1.3.13
Chrome  : 52.0.2743.82
Node    : 6.5.0
apm  1.16.1
npm  3.10.5
node 6.9.5 x64
python 2.7.10
git 2.10.1

Mac OS, El Capitan

Plugin version 4da03a6

Additional Information

I've been keeping mostly up to date on the releases, and I'm pretty sure this behavior changed within the last couple days.

Activity

  1. self-assigned this
    on May 9, 2017
  2. smashwilson commented on May 9, 2017

    @smashwilson
    Contributor

    Git and its child processes should now see all PATH entries that Atom itself does. Care to apm upgrade and confirm that it works for you?

    If it doesn't, maybe try running process.env in the Atom dev tools to see what Atom thinks your PATH is. I know that there's some ✨ magic ✨ that Atom does on launch to try to keep it consistent with user expectations but I admit I haven't dug into that myself 😄

  3. kpaulisse commented on May 9, 2017

    @kpaulisse
    Author

    Tested - this fixed the problem with the hook, and also allows the GPG signing to work. (My GPG binary is /usr/local/bin/gpg and I was getting an error on that as well, as I noted in chat.)

  4. smashwilson commented on May 9, 2017

    @smashwilson
    Contributor

    👍 Excellent, thanks for confirming!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions