mirror of
https://github.com/checkpoint-restore/criu.git
synced 2026-07-17 16:47:50 +00:00
criu-ns: Handle restore-detached option
The criu-ns script creates a new PID namespace where criu is the "init" process. When using the --restore-detached option with criu-ns, users expect criu-ns to exit without killing the restored process tree. Thus, criu-ns should not pass the --restore-detached to criu to prevent it from terminating, and it should exit instead of waiting for criu's exit status. Resolves #1278 Suggested-by: Andrei Vagin <avagin@gmail.com> Signed-off-by: Radostin Stoyanov <rstoyanov@fedoraproject.org>
This commit is contained in:
parent
6b375ed755
commit
7974229867
1 changed files with 14 additions and 1 deletions
|
|
@ -88,10 +88,23 @@ def wrap_restore():
|
|||
_errno = ctypes.get_errno()
|
||||
raise OSError(_errno, errno.errorcode[_errno])
|
||||
|
||||
restore_detached = False
|
||||
restore_args = sys.argv[1:]
|
||||
if '-d' in restore_args:
|
||||
restore_detached = True
|
||||
restore_args.remove('-d')
|
||||
if '--restore-detached' in restore_args:
|
||||
restore_detached = True
|
||||
restore_args.remove('--restore-detached')
|
||||
|
||||
criu_pid = os.fork()
|
||||
if criu_pid == 0:
|
||||
_mount_new_proc()
|
||||
run_criu(sys.argv[1:])
|
||||
run_criu(restore_args)
|
||||
|
||||
if restore_detached:
|
||||
return 0
|
||||
|
||||
return _wait_for_process_status(criu_pid)
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue