mirror of
https://github.com/tomru/pdfer.git
synced 2026-03-03 06:27:19 +01:00
extract tex cmd
to make it configurable at a later point in time
This commit is contained in:
@@ -2,7 +2,7 @@ import { mkdir, writeFile } from 'fs'
|
||||
import { spawn } from 'child_process'
|
||||
import { v1 as uuidv1 } from 'uuid'
|
||||
|
||||
import { getDirPath, getDocPath } from './utils'
|
||||
import { getDirPath, getDocPath, getTexCmd } from './utils'
|
||||
|
||||
function copyToTemp(id: string, texDocument: string): Promise<string> {
|
||||
return new Promise((resolve, reject) => {
|
||||
@@ -26,10 +26,15 @@ function copyToTemp(id: string, texDocument: string): Promise<string> {
|
||||
}
|
||||
|
||||
function generateDoc(id: string) {
|
||||
return new Promise((resolve, reject) => {
|
||||
const pdflatex = spawn('pdflatex', ['-interaction', 'nonstopmode', getDocPath(id)], { cwd: getDirPath(id) })
|
||||
pdflatex.stderr.on('data', (data) => {
|
||||
console.error('onData', data)
|
||||
return new Promise((resolve, reject): void => {
|
||||
const pdflatex = spawn(...getTexCmd(id))
|
||||
pdflatex.stderr?.on('data', (data: string) => {
|
||||
console.error('error: ', data)
|
||||
reject()
|
||||
})
|
||||
pdflatex.on('error', (error) => {
|
||||
console.error('error', error)
|
||||
reject()
|
||||
})
|
||||
|
||||
pdflatex.on('close', (code) => {
|
||||
|
||||
Reference in New Issue
Block a user