parent
df03800278
commit
42cbd9ff68
@ -245,7 +245,12 @@ class _QrexecPolicyContext(object):
|
|||||||
'allow' if allow else 'deny')
|
'allow' if allow else 'deny')
|
||||||
|
|
||||||
def _change(self, add=True):
|
def _change(self, add=True):
|
||||||
with self._filename.open('r+') as policy:
|
try:
|
||||||
|
policy = self._filename.open('r+')
|
||||||
|
except FileNotFoundError:
|
||||||
|
policy = self._filename.open('w+')
|
||||||
|
|
||||||
|
try:
|
||||||
policy_rules = policy.readlines()
|
policy_rules = policy.readlines()
|
||||||
if add:
|
if add:
|
||||||
policy_rules.insert(0, self._rule)
|
policy_rules.insert(0, self._rule)
|
||||||
@ -254,6 +259,8 @@ class _QrexecPolicyContext(object):
|
|||||||
policy.truncate(0)
|
policy.truncate(0)
|
||||||
policy.seek(0)
|
policy.seek(0)
|
||||||
policy.write(''.join(policy_rules))
|
policy.write(''.join(policy_rules))
|
||||||
|
finally:
|
||||||
|
policy.close()
|
||||||
|
|
||||||
def __enter__(self):
|
def __enter__(self):
|
||||||
self._change(add=True)
|
self._change(add=True)
|
||||||
|
@ -234,7 +234,10 @@ class TC_00_AppVMMixin(qubes.tests.SystemTestsMixin):
|
|||||||
@asyncio.coroutine
|
@asyncio.coroutine
|
||||||
def run(self):
|
def run(self):
|
||||||
p = yield from self.testvm1.run(
|
p = yield from self.testvm1.run(
|
||||||
'echo test; exec >&-; cat > /dev/null')
|
'echo test; exec >&-; cat > /dev/null',
|
||||||
|
stdin=subprocess.PIPE,
|
||||||
|
stdout=subprocess.PIPE,
|
||||||
|
stderr=subprocess.PIPE)
|
||||||
|
|
||||||
# this will hang on test failure
|
# this will hang on test failure
|
||||||
stdout = yield from p.stdout.read()
|
stdout = yield from p.stdout.read()
|
||||||
|
Loading…
Reference in New Issue
Block a user