diff --git a/mode/latex.py b/mode/latex.py index 7d58289..306505c 100644 --- a/mode/latex.py +++ b/mode/latex.py @@ -1,4 +1,4 @@ -import commands, curses, os +import commands, curses, os, sys import color, method, mode from lex import Grammar, PatternRule, RegionRule from mode.text import TextInsertSpace @@ -60,6 +60,13 @@ class LatexViewPdf(LatexBuildPdf): viewcmd = w.application.config.get('latex.pdfviewcmd') pid = os.fork() if pid == 0: + # redirect stdout/stderr to a log file + f = open('.pmacs-latex-pdf.err', 'a') + sys.stderr.flush() + os.dup2(f.fileno(), sys.stderr.fileno()) + sys.stdout.flush() + os.dup2(f.fileno(), sys.stdout.fileno()) + # ok, now do the exec pdfpath = self._modpath(w, '.pdf') os.execvp(viewcmd, (viewcmd, pdfpath))