Add an example of restricting the launch command

This commit is contained in:
Kovid Goyal 2022-08-11 07:35:18 +05:30
parent 91dbcf4df0
commit 12c99741a0
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -245,7 +245,18 @@ as shown below:
# effect on the command. # effect on the command.
# The command payload will vary from command to command, see # The command payload will vary from command to command, see
# the rc protocol docs for details. # the rc protocol docs for details. Below is an example of
# restricting the launch command to allow only running the
# default shell.
if cmd_name != 'launch':
return None
if cmd_payload.get('args') or cmd_payload.get('env') or cmd_payload.get('copy_cmdline') or cmd_payload.get('copy_env'):
return False
# prints in this function go to the parent kitty process STDOUT
print('Allowing launch command:', cmd_payload)
return True
.. _rc_mapping: .. _rc_mapping: