Skip to content

Commit

Permalink
fix: windows PATH setting for python configuration (nexe#476)
Browse files Browse the repository at this point in the history
fixes nexe#474
  • Loading branch information
JamesMGreene authored and nevilm-lt committed Feb 8, 2022
1 parent 99abd9e commit 636886f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "nexe",
"description": "Create a single executable out of your Node.js application",
"license": "MIT",
"version": "2.0.0-rc.26",
"version": "2.0.0-rc.27",
"contributors": [
"Craig Condon <[email protected]> (http://crcn.io)",
"Jared Allard <[email protected]>",
Expand Down
9 changes: 7 additions & 2 deletions src/compiler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ interface NexeHeader {

export class NexeCompiler<T extends NexeOptions = NexeOptions> {
private start = Date.now()
private env = { ...process.env }
private env: any
private compileStep: LogStep
public log = new Logger(this.options.loglevel)
public src: string
Expand All @@ -58,8 +58,13 @@ export class NexeCompiler<T extends NexeOptions = NexeOptions> {
this.log.step('nexe ' + version, 'info')
if (python) {
if (isWindows) {
this.env.PATH = '"' + dequote(normalize(python)) + '";' + this.env.PATH
// Do a little shuffling to correctly set the PATH regardless of property name case sensitivity
const originalPath = process.env.PATH
process.env.PATH = dequote(normalize(python)) + ';' + originalPath
this.env = { ...process.env }
process.env.PATH = originalPath
} else {
this.env = { ...process.env }
this.env.PYTHON = python
}
}
Expand Down

0 comments on commit 636886f

Please sign in to comment.