process: Return proc in function helpers

Caller may want to access the proc object after running the process, for
instance to check return code or inspect its stdout/stderr logs.

Change-Id: I60a18dcf699ebeaced951f7d5ff188f573772282
This commit is contained in:
Pau Espin 2019-11-26 14:25:33 +01:00
parent c18c5b82ca
commit 12c5ea4a24
1 changed files with 3 additions and 0 deletions

View File

@ -399,16 +399,19 @@ def run_local_sync(run_dir, name, popen_args):
run_dir =run_dir.new_dir(name)
proc = Process(name, run_dir, popen_args)
proc.launch_sync()
return proc
def run_local_netns_sync(run_dir, name, netns, popen_args):
run_dir =run_dir.new_dir(name)
proc = NetNSProcess(name, run_dir, netns, popen_args)
proc.launch_sync()
return proc
def run_remote_sync(run_dir, remote_user, remote_addr, name, popen_args, remote_cwd=None):
run_dir = run_dir.new_dir(name)
proc = RemoteProcess(name, run_dir, remote_user, remote_addr, remote_cwd, popen_args)
proc.launch_sync()
return proc
def scp(run_dir, remote_user, remote_addr, name, local_path, remote_path):
run_local_sync(run_dir, name, ('scp', '-r', local_path, '%s@%s:%s' % (remote_user, remote_addr, remote_path)))