Skip to content

Commit

Permalink
Get evnVars['Path'] before calling spawn since it is modified on Wind…
Browse files Browse the repository at this point in the history
  • Loading branch information
tamuratak committed May 3, 2021
1 parent 69a2bfd commit 1858bfe
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/components/builder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,7 @@ export class Builder {
this.extension.manager.setEnvVar()
const envVars: ProcessEnv = {}
Object.keys(process.env).forEach(key => envVars[key] = process.env[key])
const evnVarsPath = envVars['PATH']
const currentEnv = steps[index].env
if (currentEnv) {
Object.keys(currentEnv).forEach(key => envVars[key] = currentEnv[key])
Expand Down Expand Up @@ -298,7 +299,7 @@ export class Builder {

this.currentProcess.on('error', err => {
this.extension.logger.addLogMessage(`LaTeX fatal error: ${err.message}, ${stderr}. PID: ${pid}.`)
this.extension.logger.addLogMessage(`Does the executable exist? PATH: ${envVars['PATH']}`)
this.extension.logger.addLogMessage(`Does the executable exist? PATH: ${evnVarsPath}`)
this.extension.logger.addLogMessage(`The environment variable $SHELL: ${process.env.SHELL}`)
this.extension.logger.displayStatus('x', 'errorForeground', `Recipe terminated with fatal error: ${err.message}.`, 'error')
this.currentProcess = undefined
Expand All @@ -309,7 +310,7 @@ export class Builder {
this.extension.compilerLogParser.parse(stdout, rootFile)
if (exitCode !== 0) {
this.extension.logger.addLogMessage(`Recipe returns with error: ${exitCode}/${signal}. PID: ${pid}. message: ${stderr}.`)
this.extension.logger.addLogMessage(`The environment variable $PATH: ${envVars['PATH']}`)
this.extension.logger.addLogMessage(`The environment variable $PATH: ${evnVarsPath}`)
this.extension.logger.addLogMessage(`The environment variable $SHELL: ${process.env.SHELL}`)

const configuration = vscode.workspace.getConfiguration('latex-workshop')
Expand Down

1 comment on commit 1858bfe

@tamuratak
Copy link
Contributor Author

@tamuratak tamuratak commented on 1858bfe May 3, 2021

Choose a reason for hiding this comment

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

  • wrong: Get evnVars['Path'] before calling ...
  • correct: Get evnVars['PATH'] before calling ...

Please sign in to comment.