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

Set working directory when calling LaTex binaries #533

Merged
merged 1 commit into from
Apr 12, 2018
Merged
Show file tree
Hide file tree
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
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