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,
|
||||
debug=args.debug)
|
||||
with server.serve(handler=handler, timeout=args.timeout) as env:
|
||||
return server.run_process(command=command,
|
||||
environ=env,
|
||||
use_shell=use_shell)
|
||||
return server.run_process(command=command, environ=env)
|
||||
except KeyboardInterrupt:
|
||||
log.info('server stopped')
|
||||
|
||||
|
||||
@@ -131,7 +131,7 @@ def serve(handler, sock_path=None, timeout=UNIX_SOCKET_TIMEOUT):
|
||||
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.
|
||||
|
||||
@@ -141,7 +141,7 @@ def run_process(command, environ, use_shell=False):
|
||||
env = dict(os.environ)
|
||||
env.update(environ)
|
||||
try:
|
||||
p = subprocess.Popen(args=command, env=env, shell=use_shell)
|
||||
p = subprocess.Popen(args=command, env=env)
|
||||
except OSError as e:
|
||||
raise OSError('cannot run %r: %s' % (command, e))
|
||||
log.debug('subprocess %d is running', p.pid)
|
||||
|
||||
@@ -91,10 +91,8 @@ def test_spawn():
|
||||
def test_run():
|
||||
assert server.run_process(['true'], environ={}) == 0
|
||||
assert server.run_process(['false'], environ={}) == 1
|
||||
assert server.run_process(
|
||||
command='exit $X',
|
||||
environ={'X': '42'},
|
||||
use_shell=True) == 42
|
||||
assert server.run_process(command=['bash', '-c', 'exit $X'],
|
||||
environ={'X': '42'}) == 42
|
||||
|
||||
with pytest.raises(OSError):
|
||||
server.run_process([''], environ={})
|
||||
|
||||
Reference in New Issue
Block a user