xz-compress logs only if -lo ends with .xz

This commit is contained in:
ed 2022-11-15 20:16:41 +00:00
parent 8829f56d4c
commit 97ff0ebd06

View file

@ -346,10 +346,12 @@ class SvcHub(object):
fn = sel_fn
try:
import lzma
lh = lzma.open(fn, "wt", encoding="utf-8", errors="replace", preset=0)
if fn.lower().endswith(".xz"):
import lzma
lh = lzma.open(fn, "wt", encoding="utf-8", errors="replace", preset=0)
else:
lh = open(fn, "wt", encoding="utf-8", errors="replace")
except:
import codecs