@@ -1458,20 +1458,17 @@ 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
- command = '%s cd "%s" && latex -interaction=nonstopmode "%s" > "%s"' \
1470
- % ( precmd , tmpdir , latexfile , outfile )
1465
+ command = [ str ( "latex" ), " -interaction=nonstopmode" ,
1466
+ '"%s"' % latexfile ]
1471
1467
verbose .report (command , 'debug' )
1472
1468
try :
1473
- output = subprocess .check_output (command , shell = True ,
1474
- stderr = subprocess .STDOUT )
1469
+ with open (outfile , "w" ) as fout :
1470
+ subprocess .check_call (command , cwd = tmpdir ,
1471
+ stdout = fout , stderr = subprocess .STDOUT )
1475
1472
except subprocess .CalledProcessError as exc :
1476
1473
with io .open (outfile , 'rb' ) as fh :
1477
1474
raise RuntimeError ('LaTeX was not able to process your file: '
@@ -1482,12 +1479,13 @@ def convert_psfrags(tmpfile, psfrags, font_preamble, custom_preamble,
1482
1479
verbose .report (fh .read (), 'debug' )
1483
1480
os .remove (outfile )
1484
1481
1485
- command = '%s cd "%s" && dvips -q -R0 -o "%s" "%s" > "%s"' % ( precmd , tmpdir ,
1486
- os .path .split ( psfile )[ - 1 ], os . path . split ( dvifile )[ - 1 ], outfile )
1482
+ command = [ str ( ' dvips' ), '-q' , ' -R0' , '-o' , os . path . basename ( psfile ) ,
1483
+ os .path .basename ( dvifile )]
1487
1484
verbose .report (command , 'debug' )
1488
1485
try :
1489
- output = subprocess .check_output (command , shell = True ,
1490
- stderr = subprocess .STDOUT )
1486
+ with open (outfile , "w" ) as fout :
1487
+ subprocess .check_call (command , cwd = tmpdir ,
1488
+ stdout = fout , stderr = subprocess .STDOUT )
1491
1489
except subprocess .CalledProcessError as exc :
1492
1490
with io .open (outfile , 'rb' ) as fh :
1493
1491
raise RuntimeError ('dvips was not able to process the following '
0 commit comments