improved handling of stdout/stderr after fork()
--HG-- branch : pmacs2
This commit is contained in:
parent
7d2a8959d2
commit
f3cac461cd
|
@ -1,4 +1,4 @@
|
||||||
import commands, curses, os
|
import commands, curses, os, sys
|
||||||
import color, method, mode
|
import color, method, mode
|
||||||
from lex import Grammar, PatternRule, RegionRule
|
from lex import Grammar, PatternRule, RegionRule
|
||||||
from mode.text import TextInsertSpace
|
from mode.text import TextInsertSpace
|
||||||
|
@ -60,6 +60,13 @@ class LatexViewPdf(LatexBuildPdf):
|
||||||
viewcmd = w.application.config.get('latex.pdfviewcmd')
|
viewcmd = w.application.config.get('latex.pdfviewcmd')
|
||||||
pid = os.fork()
|
pid = os.fork()
|
||||||
if pid == 0:
|
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')
|
pdfpath = self._modpath(w, '.pdf')
|
||||||
os.execvp(viewcmd, (viewcmd, pdfpath))
|
os.execvp(viewcmd, (viewcmd, pdfpath))
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue