Running a source command before launching main command

René J.V. Bertin rjvbertin at
Wed Jul 28 16:13:41 BST 2021

On Wednesday July 28 2021 11:44:23 Mahmood Naderan wrote:

>some variables and preprocessing. I know how to set variables in the launch
>configuration, but I would like to know how to specify that source command
>in the launch configuration where executable, arguments and working
>directory are set.


I suppose there is no clear place to specify a set-up command (I don't use this functionality)?

In that case, your best option would be to turn your "source" command into a wrapper script that first does the sourcing and then exec's the actually intended command:


# do your source command

exec ${COMMAND} "$@"

If your launch configuration is meant to debug your code this will probably not work, but you could try this as the command:

sh /path/to/wrapper /path/to/yourExecutable [args]

(this will cause the debugger to see a binary, which at some point will overlay itself with your own code).

If that doesn't work either you'll have no other choice but to call KDevelop itself via the wrapper script. Or implement the missing feature yourself (and propose it for inclusion).


More information about the KDevelop mailing list