log a warning that double --single-instance will ignore the one from macos-launch-services-cmdline

This commit is contained in:
Kovid Goyal
2024-09-15 10:38:32 +05:30
parent 0db2cf91a9
commit e3124812e5

View File

@@ -321,10 +321,16 @@ def macos_cmdline(argv_args: list[str]) -> list[str]:
if ans and ans[0] == 'kitty':
del ans[0]
if '-1' in ans or '--single-instance' in ans:
# Re-exec with new argv so that the C code that handles single instance
# can pick up the modified argv
os.environ['KITTY_LAUNCHED_BY_LAUNCH_SERVICES'] = '2' # so that use_os_log is set in the re-execed process
os.execl(kitty_exe(), 'kitty', *(ans + argv_args))
if '-1' in argv_args or '--single-instance' in argv_args:
# C code will already have setup single instance
log_error(
'--single-instance supplied in both command line arguments and macos-launch-services-cmdline,'
' ignoring any --instance-group in macos-launch-services-cmdline')
else:
# Re-exec with new argv so that the C code that handles single instance
# can pick up the modified argv
os.environ['KITTY_LAUNCHED_BY_LAUNCH_SERVICES'] = '2' # so that use_os_log is set in the re-execed process
os.execl(kitty_exe(), 'kitty', *(ans + argv_args))
return ans + argv_args