Skip to content

Pass git the shell environment's PATH. - #1578

Closed
EtherTyper wants to merge 4 commits into
desktop:masterfrom
EtherTyper:patch-1
Closed

EtherTyper wants to merge 4 commits into
desktop:masterfrom
EtherTyper:patch-1

Conversation

@EtherTyper

Copy link
Copy Markdown

This should fix #1391 and #78. It uses the same fix as atom/github#765.

I tested this by committing it (c1e0b2c) with a signature from the GitHub Desktop app itself.

@EtherTyper EtherTyper changed the title Pass git the shell environment. Pass git the shell environment's PATH. May 17, 2017
@shiftkey shiftkey self-assigned this May 17, 2017
@shiftkey shiftkey added the ready-for-review Pull Requests that are ready to be reviewed by the maintainers label May 17, 2017

@shiftkey shiftkey left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I want to get this setup and tested so I can validate it's fixed, but here are some initial comments.

Comment thread app/src/lib/git/core.ts Outdated
successExitCodes: new Set([ 0 ]),
expectedErrors: new Set(),
env: {
GIT_TERMINAL_PROMPT: '0',

This comment was marked as spam.

This comment was marked as spam.

Comment thread app/src/lib/git/core.ts
expectedErrors: new Set(),
env: {
GIT_TERMINAL_PROMPT: '0',
PATH: process.env.PATH || '',

This comment was marked as spam.

This comment was marked as spam.

@joshaber

Copy link
Copy Markdown
Contributor

I haven't dug into this at all, but I'm a bit surprised a spawned task doesn't already inherit the parent's environment.

@shiftkey

Copy link
Copy Markdown
Member

@joshaber yeah, I'm gonna look into some reading and experimenting about this tomorrow - I've done a bunch of hacks around stuff, I should get back to the basics.

A skim of the child_process docs don't show anything interesting though 🤔

@joshaber

Copy link
Copy Markdown
Contributor

Also maybe helpful context: macOS apps don't inherit the environment unless they're launched from a shell. So the behavior you see when doing, e.g., npm start is different from the behavior you'll see when you launch the app from Finder.

@EtherTyper

Copy link
Copy Markdown
Author

@joshaber Yup, it turns out the fix only works on development builds (yarn build:dev && yarn run), and not by launching the application produced by yarn build:prod.

@EtherTyper

Copy link
Copy Markdown
Author

In that case, why does the same sort of fix work for atom/github?

@joshaber

Copy link
Copy Markdown
Contributor

Atom does some fancy footwork to get the shell environment regardless of how they're launched. See atom/atom#11054.

@EtherTyper

EtherTyper commented May 18, 2017 •

Copy link
Copy Markdown
Author

Oh. Should I close this pull request for now until that work gets done for Desktop then?

@joshaber

Copy link
Copy Markdown
Contributor

Sure, unless you wanna repurpose this PR for that 😄

@EtherTyper EtherTyper closed this May 18, 2017
@shiftkey shiftkey mentioned this pull request Jul 24, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready-for-review Pull Requests that are ready to be reviewed by the maintainers

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants