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

Fix #667 - use which's result #668

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions lib/configure.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@ function configure (gyp, argv, callback) {
}
} else {
log.verbose('`which` succeeded', python, execPath)
// Found the `python` exceutable, and from now on we use it explicitly
// This solves #667 and #750 (`execFile` won't run batch files (*.cmd, and *.bat))
python = execPath
Copy link
Member

Choose a reason for hiding this comment

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

What does this fix? If which('python') succeeds, then by definition python is on the PATH, right?

EDIT: Let me rephrase. #750 is about batch files. How does using execPath help here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

the which module is more similar to windows PATH resolution semantics then the following require('child_process').execFile in line 85.
execFile fails to resolve *.bat and *.cmd files from the PATH, but will run them if explicitly specified to.

Copy link
Member

Choose a reason for hiding this comment

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

Can you add a comment explaining that (Properly capitalized and punctuated, please.)?

It would be nice to have some kind of regression test for this. Maybe you can module.exports.test.checkPython = checkPython and verify in the test that executing the result with -V prints the python version banner?

Copy link
Member

Choose a reason for hiding this comment

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

I went ahead and filed a PR that adds a regression test: #756

checkPythonVersion()
}
})
Expand Down