Skip to content
  • Marc-André Lureau's avatar
    a95570e3
    io/command: use glib GSpawn, instead of open-coding fork/exec · a95570e3
    Marc-André Lureau authored
    
    
    Simplify qio_channel_command_new_spawn() with GSpawn API. This will
    allow to build for WIN32 in the following patches.
    
    As pointed out by Daniel Berrangé: there is a change in semantics here
    too. The current code only touches stdin/stdout/stderr. Any other FDs
    which do NOT have O_CLOEXEC set will be inherited. With the new code,
    all FDs except stdin/out/err will be explicitly closed, because we don't
    set the flag G_SPAWN_LEAVE_DESCRIPTORS_OPEN. The only place we use
    QIOChannelCommand today is the migration exec: protocol, and that is
    only declared to use stdin/stdout.
    
    Reviewed-by: default avatarDaniel P. Berrangé <berrange@redhat.com>
    Signed-off-by: default avatarMarc-André Lureau <marcandre.lureau@redhat.com>
    Message-Id: <20221006113657.2656108-5-marcandre.lureau@redhat.com>
    a95570e3
    io/command: use glib GSpawn, instead of open-coding fork/exec
    Marc-André Lureau authored
    
    
    Simplify qio_channel_command_new_spawn() with GSpawn API. This will
    allow to build for WIN32 in the following patches.
    
    As pointed out by Daniel Berrangé: there is a change in semantics here
    too. The current code only touches stdin/stdout/stderr. Any other FDs
    which do NOT have O_CLOEXEC set will be inherited. With the new code,
    all FDs except stdin/out/err will be explicitly closed, because we don't
    set the flag G_SPAWN_LEAVE_DESCRIPTORS_OPEN. The only place we use
    QIOChannelCommand today is the migration exec: protocol, and that is
    only declared to use stdin/stdout.
    
    Reviewed-by: default avatarDaniel P. Berrangé <berrange@redhat.com>
    Signed-off-by: default avatarMarc-André Lureau <marcandre.lureau@redhat.com>
    Message-Id: <20221006113657.2656108-5-marcandre.lureau@redhat.com>
Loading