Create a backup of working config.yaml after startup

This commit is contained in:
Gina Häußge committed 2018-11-22 13:47:02 +01:00
1 parent 92629468c0
commit 170804d4df
3 files changed
+21 -5

No files matched your search

+4 -1
View File
@@ -8,6 +8,8 @@ __copyright__ = "Copyright (C) 2014 The OctoPrint Project - Released under terms
from .exceptions import ScriptError
import logging
def execute(command, cwd=None, evaluate_returncode=True, **kwargs):
do_async = kwargs.get("do_async", kwargs.get("async", False))
@@ -16,8 +18,9 @@ def execute(command, cwd=None, evaluate_returncode=True, **kwargs):
p = None
try:
p = sarge.run(command, cwd=cwd, stdout=sarge.Capture(), stderr=sarge.Capture(), async_=do_async)
p = sarge.run(command, cwd=cwd, stdout=sarge.Capture(), stderr=sarge.Capture(), async=do_async)
except:
logging.getLogger(__name__).exception("Error while executing command: {}".format(command))
returncode = p.returncode if p is not None else None
stdout = p.stdout.text if p is not None and p.stdout is not None else ""
stderr = p.stderr.text if p is not None and p.stderr is not None else ""