@@ -1458,19 +1458,16 @@ def convert_psfrags(tmpfile, psfrags, font_preamble, custom_preamble,
1458
1458
"rcParam." , 'helpful' )
1459
1459
raise
1460
1460
1461
- # the split drive part of the command is necessary for windows users with
1462
- # multiple
1463
- if sys .platform == 'win32' : precmd = '%s &&' % os .path .splitdrive (tmpdir )[0 ]
1464
- else : precmd = ''
1465
1461
#Replace \\ for / so latex does not think there is a function call
1466
1462
latexfile = latexfile .replace ("\\ " , "/" )
1467
1463
# Replace ~ so Latex does not think it is line break
1468
1464
latexfile = latexfile .replace ("~" , "\\ string~" )
1469
1465
command = [str ('latex' ), '-interction=nonstopmode' , '"%s"' % (latexfile )]
1470
1466
verbose .report (command , 'debug' )
1471
1467
try :
1472
- output = subprocess .check_output (command , shell = True ,
1473
- stderr = subprocess .STDOUT )
1468
+ with open (outfile , "w" ) as fout :
1469
+ subprocess .check_call (command , cwd = tmpdir ,
1470
+ stdout = fout , stderr = subprocess .STDOUT )
1474
1471
except subprocess .CalledProcessError as exc :
1475
1472
with io .open (outfile , 'rb' ) as fh :
1476
1473
raise RuntimeError ('LaTeX was not able to process your file: '
@@ -1481,12 +1478,13 @@ def convert_psfrags(tmpfile, psfrags, font_preamble, custom_preamble,
1481
1478
verbose .report (fh .read (), 'debug' )
1482
1479
os .remove (outfile )
1483
1480
1484
- command = '%s cd "%s" && dvips -q -R0 -o "%s" "%s" > "%s"' % ( precmd , tmpdir ,
1485
- os . path . split ( psfile )[ - 1 ], os .path .split (dvifile )[ - 1 ], outfile )
1481
+ command = [ ' dvips' , '-q' , ' -R0' , '-o' , ' "%s"' % os . path . basename ( psfile ) ,
1482
+ '"%s"' % os .path .basename (dvifile )]
1486
1483
verbose .report (command , 'debug' )
1487
1484
try :
1488
- output = subprocess .check_output (command , shell = True ,
1489
- stderr = subprocess .STDOUT )
1485
+ with open (outfile , "w" ) as fout :
1486
+ subprocess .check_call (command , cwd = tmpdir ,
1487
+ stdout = fout , stderr = subprocess .STDOUT )
1490
1488
except subprocess .CalledProcessError as exc :
1491
1489
with io .open (outfile , 'rb' ) as fh :
1492
1490
raise RuntimeError ('dvips was not able to process the following '
0 commit comments