use specified tmpdir when sorting

This commit is contained in:
Rico Sennrich 2012-02-28 10:05:30 +01:00
parent b99ebb7a19
commit 7927979298

View File

@ -1262,6 +1262,8 @@ def sort_file(filename,tempdir=None):
cmd = ['sort', filename] cmd = ['sort', filename]
env = {} env = {}
env['LC_ALL'] = 'C' env['LC_ALL'] = 'C'
if tempdir:
cmd.extend(['-T',tempdir])
outfile = NamedTemporaryFile(delete=False,dir=tempdir) outfile = NamedTemporaryFile(delete=False,dir=tempdir)
sys.stderr.write('LC_ALL=C ' + ' '.join(cmd) + ' > ' + outfile.name + '\n') sys.stderr.write('LC_ALL=C ' + ' '.join(cmd) + ' > ' + outfile.name + '\n')