take environment directly in edit method

This commit is contained in:
Maximilian Keßler 2021-09-18 14:38:20 +02:00
parent 32487937a9
commit 7728ec97ca

View File

@ -5,14 +5,11 @@ from pathlib import Path
import os
def edit(filepath: Path, rootpath: Path = None, texinputs=None):
env = dict(os.environ)
if texinputs:
env["TEXINPUTS"] = texinputs
def edit(filepath: Path, rootpath: Path = None, env=os.environ):
if not rootpath:
rootpath = filepath
subprocess.Popen([
"termite",
"-e",
f"vim --servername tex-vorlesung --remote-silent {str(filepath)}"
], env=env, cwd=str(rootpath.root))
], env=env, cwd=str(rootpath))