Skip to content

Commit

Permalink
Merge pull request #533 from Arxisos/master
Browse files Browse the repository at this point in the history
Set working directory when calling LaTex binaries
  • Loading branch information
James-Yu authored Apr 12, 2018
2 parents 6fb506a + 60c8206 commit ce3ef1b
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/components/linter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ export class Linter {

let stdout: string
try {
stdout = await this.processWrapper('active file', command, args.concat(requiredArgs).filter(arg => arg !== ''), {}, content)
stdout = await this.processWrapper('active file', command, args.concat(requiredArgs).filter(arg => arg !== ''), {cwd: path.dirname(filePath)}, content)
} catch (err) {
if ('stdout' in err) {
stdout = err.stdout
Expand Down
4 changes: 2 additions & 2 deletions src/components/locator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ export class Locator {
const args = ['view', '-i', `${line}:${position.character + 1}:${filePath}`, '-o', pdfFile]
this.extension.logger.addLogMessage(`Executing synctex with args ${args}`)

const proc = cp.spawn(configuration.get('synctex.path') as string, args)
const proc = cp.spawn(configuration.get('synctex.path') as string, args, {cwd: path.dirname(pdfFile)})
proc.stdout.setEncoding('utf8')
proc.stderr.setEncoding('utf8')

Expand Down Expand Up @@ -109,7 +109,7 @@ export class Locator {
const args = ['edit', '-o', `${data.page}:${data.pos[0]}:${data.pos[1]}:${pdfPath}`]
this.extension.logger.addLogMessage(`Executing synctex with args ${args}`)

const proc = cp.spawn(configuration.get('synctex.path') as string, args)
const proc = cp.spawn(configuration.get('synctex.path') as string, args, {cwd: path.dirname(pdfPath)})
proc.stdout.setEncoding('utf8')
proc.stderr.setEncoding('utf8')

Expand Down
2 changes: 1 addition & 1 deletion src/providers/latexformatter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ export class LaTexFormatter {
.replace('%TMPFILE%', temporaryFile.split(path.sep).join('/'))
.replace('%INDENT%', indent))

const worker = cp.spawn(this.formatter, args, { stdio: 'pipe' })
const worker = cp.spawn(this.formatter, args, { stdio: 'pipe', cwd: path.dirname(document.fileName) })
// handle stdout/stderr
const stdoutBuffer = [] as string[]
const stderrBuffer = [] as string[]
Expand Down

0 comments on commit ce3ef1b

Please sign in to comment.