_run_qrexec_repo: default C local in subprocess call

This commit is contained in:
Frédéric Pierret (fepitre) 2019-11-11 17:08:19 +01:00
parent 0bacf37994
commit 51acbde8d5
No known key found for this signature in database
GPG Key ID: 484010B5CDC576E2

View File

@ -20,6 +20,7 @@
#
#
import os
import subprocess
from PyQt5 import QtWidgets, QtCore, QtGui # pylint: disable=import-error
@ -34,13 +35,18 @@ qmemman_config_path = '/etc/qubes/qmemman.conf'
def _run_qrexec_repo(service, arg=''):
# Set default locale to C in order to prevent error msg
# in subprocess call related to falling back to C locale
env = os.environ
env['LC_ALL'] = 'C'
# Fake up a "qrexec call" to dom0 because dom0 can't qrexec to itself yet
cmd = '/etc/qubes-rpc/' + service
p = subprocess.run(
['sudo', cmd, arg],
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
check=False
check=False,
env=env
)
if p.stderr:
raise RuntimeError(