main: remove unneeded use_shell parameter
This commit is contained in:
@@ -131,9 +131,7 @@ def run_agent(client_factory):
|
|||||||
handler = protocol.Handler(keys=public_keys, signer=signer,
|
handler = protocol.Handler(keys=public_keys, signer=signer,
|
||||||
debug=args.debug)
|
debug=args.debug)
|
||||||
with server.serve(handler=handler, timeout=args.timeout) as env:
|
with server.serve(handler=handler, timeout=args.timeout) as env:
|
||||||
return server.run_process(command=command,
|
return server.run_process(command=command, environ=env)
|
||||||
environ=env,
|
|
||||||
use_shell=use_shell)
|
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
log.info('server stopped')
|
log.info('server stopped')
|
||||||
|
|
||||||
|
|||||||
@@ -131,7 +131,7 @@ def serve(handler, sock_path=None, timeout=UNIX_SOCKET_TIMEOUT):
|
|||||||
quit_event.set()
|
quit_event.set()
|
||||||
|
|
||||||
|
|
||||||
def run_process(command, environ, use_shell=False):
|
def run_process(command, environ):
|
||||||
"""
|
"""
|
||||||
Run the specified process and wait until it finishes.
|
Run the specified process and wait until it finishes.
|
||||||
|
|
||||||
@@ -141,7 +141,7 @@ def run_process(command, environ, use_shell=False):
|
|||||||
env = dict(os.environ)
|
env = dict(os.environ)
|
||||||
env.update(environ)
|
env.update(environ)
|
||||||
try:
|
try:
|
||||||
p = subprocess.Popen(args=command, env=env, shell=use_shell)
|
p = subprocess.Popen(args=command, env=env)
|
||||||
except OSError as e:
|
except OSError as e:
|
||||||
raise OSError('cannot run %r: %s' % (command, e))
|
raise OSError('cannot run %r: %s' % (command, e))
|
||||||
log.debug('subprocess %d is running', p.pid)
|
log.debug('subprocess %d is running', p.pid)
|
||||||
|
|||||||
@@ -91,10 +91,8 @@ def test_spawn():
|
|||||||
def test_run():
|
def test_run():
|
||||||
assert server.run_process(['true'], environ={}) == 0
|
assert server.run_process(['true'], environ={}) == 0
|
||||||
assert server.run_process(['false'], environ={}) == 1
|
assert server.run_process(['false'], environ={}) == 1
|
||||||
assert server.run_process(
|
assert server.run_process(command=['bash', '-c', 'exit $X'],
|
||||||
command='exit $X',
|
environ={'X': '42'}) == 42
|
||||||
environ={'X': '42'},
|
|
||||||
use_shell=True) == 42
|
|
||||||
|
|
||||||
with pytest.raises(OSError):
|
with pytest.raises(OSError):
|
||||||
server.run_process([''], environ={})
|
server.run_process([''], environ={})
|
||||||
|
|||||||
Reference in New Issue
Block a user