Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@

_logger = logging.getLogger(__name__)

GAME_LAUNCH_WAIT_FILE = Path("/tmp/es-gamelaunch.wait")

# A lock to safely modify the active controller list from multiple threads
_player_controllers_lock = threading.Lock()
# A global variable to hold the current, up-to-date list of player controllers
Expand Down Expand Up @@ -718,6 +720,31 @@ def runCommand(command: Command) -> int:
if not command.array:
raise BadCommandLineArguments

if GAME_LAUNCH_WAIT_FILE.exists():
try:
subprocess.run(
[
"inotifywait",
"-q",
"-t", "5",
"-e", "delete_self",
"-e", "move_self",
str(GAME_LAUNCH_WAIT_FILE),
],
stdout=subprocess.DEVNULL,
stderr=subprocess.DEVNULL,
check=False,
timeout=6,
)
except (OSError, subprocess.TimeoutExpired):
pass

if GAME_LAUNCH_WAIT_FILE.exists():
_logger.warning(
"EmulationStation launch transition wait did not complete normally. "
"Continuing game launch."
)

proc = subprocess.Popen(["nice", "-n", "-4", *command.array], env=command.env, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
exitcode = 0

Expand Down
Loading