Skip to content
Snippets Groups Projects
  • Simon McVittie's avatar
    18bdc4b9
    adverb, wrap: Add --terminate-timeout, --terminate-idle-timeout options · 18bdc4b9
    Simon McVittie authored
    
    This will let us have the following logic when sharing a container
    between multiple commands using -launcher and -launch:
    
    * For setup commands, don't wrap the launched command in the adverb.
      If the setup command starts background processes, they'll continue
      to run. This matches how installscript commands have historically
      worked for Windows (and Wine/Proton) games in Steam: the setup
      command is launched with system(), and can leak background
      processes like wineserver.
    
    * For the main game, wait for all processes to exit, by wrapping
      the launched command in the adverb, with --subreaper only. This
      matches how native Linux games, and the main command of
      Windows/Wine/Proton games, have historically worked in Steam.
    
    * When all processes belonging to the main game have exited,
      the -launcher can exit, at which point the subreaper that wraps it
      can clean up any background processes from the setup commands.
    
    --terminate-idle-timeout can be used to wait a few seconds before
    sending SIGTERM, if desired.
    
    Because the adverb now blocks SIGCHLD, we need to unblock it before
    running the child process; otherwise the child process will inherit
    the blocked signal, breaking things like g_spawn_async().
    
    Signed-off-by: default avatarSimon McVittie <smcv@collabora.com>
    18bdc4b9
    History
    adverb, wrap: Add --terminate-timeout, --terminate-idle-timeout options
    Simon McVittie authored
    
    This will let us have the following logic when sharing a container
    between multiple commands using -launcher and -launch:
    
    * For setup commands, don't wrap the launched command in the adverb.
      If the setup command starts background processes, they'll continue
      to run. This matches how installscript commands have historically
      worked for Windows (and Wine/Proton) games in Steam: the setup
      command is launched with system(), and can leak background
      processes like wineserver.
    
    * For the main game, wait for all processes to exit, by wrapping
      the launched command in the adverb, with --subreaper only. This
      matches how native Linux games, and the main command of
      Windows/Wine/Proton games, have historically worked in Steam.
    
    * When all processes belonging to the main game have exited,
      the -launcher can exit, at which point the subreaper that wraps it
      can clean up any background processes from the setup commands.
    
    --terminate-idle-timeout can be used to wait a few seconds before
    sending SIGTERM, if desired.
    
    Because the adverb now blocks SIGCHLD, we need to unblock it before
    running the child process; otherwise the child process will inherit
    the blocked signal, breaking things like g_spawn_async().
    
    Signed-off-by: default avatarSimon McVittie <smcv@collabora.com>