mirror of
https://github.com/3b1b/manim.git
synced 2025-09-01 00:48:45 +00:00
Improved stability for Windows NT OS
This commit is contained in:
parent
9958a73059
commit
68771e105a
2 changed files with 14 additions and 3 deletions
|
@ -294,6 +294,11 @@ def generate_tex_file(expression, template_tex_file):
|
||||||
outfile.write(body)
|
outfile.write(body)
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
def get_null():
|
||||||
|
if os.name == "nt":
|
||||||
|
return "NUL"
|
||||||
|
return "/dev/null"
|
||||||
|
|
||||||
def tex_to_dvi(tex_file):
|
def tex_to_dvi(tex_file):
|
||||||
result = tex_file.replace(".tex", ".dvi")
|
result = tex_file.replace(".tex", ".dvi")
|
||||||
if not os.path.exists(result):
|
if not os.path.exists(result):
|
||||||
|
@ -303,7 +308,8 @@ def tex_to_dvi(tex_file):
|
||||||
"-halt-on-error",
|
"-halt-on-error",
|
||||||
"-output-directory=" + TEX_DIR,
|
"-output-directory=" + TEX_DIR,
|
||||||
tex_file,
|
tex_file,
|
||||||
"> /dev/null"
|
">",
|
||||||
|
get_null()
|
||||||
]
|
]
|
||||||
exit_code = os.system(" ".join(commands))
|
exit_code = os.system(" ".join(commands))
|
||||||
if exit_code != 0:
|
if exit_code != 0:
|
||||||
|
@ -334,7 +340,8 @@ def dvi_to_svg(dvi_file, regen_if_exists = False):
|
||||||
"0",
|
"0",
|
||||||
"-o",
|
"-o",
|
||||||
result,
|
result,
|
||||||
"> /dev/null"
|
">",
|
||||||
|
get_null()
|
||||||
]
|
]
|
||||||
os.system(" ".join(commands))
|
os.system(" ".join(commands))
|
||||||
return result
|
return result
|
||||||
|
|
|
@ -5,6 +5,7 @@ import itertools as it
|
||||||
import warnings
|
import warnings
|
||||||
import time
|
import time
|
||||||
import os
|
import os
|
||||||
|
import shutil
|
||||||
import copy
|
import copy
|
||||||
from tqdm import tqdm as ProgressDisplay
|
from tqdm import tqdm as ProgressDisplay
|
||||||
import inspect
|
import inspect
|
||||||
|
@ -497,6 +498,9 @@ class Scene(object):
|
||||||
def close_movie_pipe(self):
|
def close_movie_pipe(self):
|
||||||
self.writing_process.stdin.close()
|
self.writing_process.stdin.close()
|
||||||
self.writing_process.wait()
|
self.writing_process.wait()
|
||||||
|
if os.name == 'nt':
|
||||||
|
shutil.move(*self.args_to_rename_file)
|
||||||
|
else:
|
||||||
os.rename(*self.args_to_rename_file)
|
os.rename(*self.args_to_rename_file)
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue