X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=lib%2Fscripts%2Fclean_dvi.py;h=5c346362e8c54ef6cc6717684343a8f264b9c791;hb=9da74fe2078e24e1e7891784ecbfe33ff77e7f85;hp=2c8bdd8bf9c9597b5e0ba19f6a87b73b41913141;hpb=2ae2c0db71bc88ac0c3e11c3cbd33e6a90ae8f6d;p=lyx.git diff --git a/lib/scripts/clean_dvi.py b/lib/scripts/clean_dvi.py index 2c8bdd8bf9..5c346362e8 100644 --- a/lib/scripts/clean_dvi.py +++ b/lib/scripts/clean_dvi.py @@ -28,7 +28,7 @@ It requires dv2dt and dt2dv from the DTL dviware package http://www.ctan.org/tex-archive/dviware/dtl/ ''' -import os, re, sys +import os, re, subprocess, sys def usage(prog_name): return 'Usage: %s in.dvi out.dvi\n' \ @@ -79,9 +79,16 @@ def main(argv): error('Unable to read "%s"\n' % infile) # Convert the input .dvi file to .dtl format. + if os.name == 'nt': + unix = False + else: + unix = True dv2dt_call = 'dv2dt "%s"' % infile - dv2dt_stdin, dv2dt_stdout, dv2dt_stderr = \ - os.popen3(dv2dt_call, 't') + dv2dt_pipe = subprocess.Popen(dv2dt_call, universal_newlines=True, \ + stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE, \ + shell=unix, close_fds=unix) + (dv2dt_stdin, dv2dt_stdout, dv2dt_stderr) = \ + (dv2dt_pipe.stdin, dv2dt_pipe.stdout, dv2dt_pipe.stderr) dv2dt_stdin.close() dv2dt_data = dv2dt_stdout.read()