[cli] Add flag to close console immediately on launch

Adds a --hidden flag to the legendary launch command that closes the console upon a game's launch, restoring the way it worked from version 0.20.34 "Direct Intervention" and lower, while keeping the default as visible as is with 0.21.0 "Lowlife".
This commit is contained in:
zzahkaboom24 2026-08-17 22:41:25 +02:00 committed by GitHub
parent 1be4b7e2ba
commit d88fb55d7b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -738,7 +738,9 @@ class LegendaryCLI:
if params.environment:
logger.debug('Environment overrides: {}'.format(', '.join(
f'{k}={v}' for k, v in params.environment.items())))
subprocess.Popen(full_params, cwd=params.working_directory, env=full_env, shell=os.name == 'nt')
subprocess.Popen(full_params, cwd=params.working_directory, env=full_env,
shell=os.name == 'nt',
creationflags=subprocess.CREATE_NO_WINDOW if os.name == 'nt' and args.hidden else 0)
def _launch_third_party(self, args):
game = self.core.get_game(app_name=args.app_name)
@ -2917,6 +2919,8 @@ def main():
help='Launch Ubisoft to install and run the game.')
launch_parser.add_argument('--json', dest='json', action='store_true',
help='Print launch information as JSON and exit')
launch_parser.add_argument('--hidden', dest='hidden', action='store_true',
help='Hide the console for the launched game on Windows')
if os.name != 'nt':
launch_parser.add_argument('--wine', dest='wine_bin', action='store', metavar='<wine binary>',