It's dead easy to run code in an external process, so that Leo doesn't hang. Just use g.execute_shell_commands.
For example, I can test Qt Quick code without hanging Leo like this:
g.execute_shell_commands('qmlscene /test/qml_test.qml')
The "work flow" is as follows:
1. Define "@file /test/qml_test.py" containing the code to be tested. You can use @others and section references as always, but you must define c, g and p yourself.
2. Define @button qml-test containing just the call to g.execute_shell_commands given above.
3. The @button node defines a new command, "qml-test". After running the command from the minibuffer, you can re-run the test using Ctrl-P, repeat-complex-command.
Similarly, Leo can run code in any language. Just do something like this:
g.execute_shell_commands([
'<path to>compiler <path to>program',
'<command to run> <resulting program>',
])
Edward
P. S. g.execute_shell_commands_with_options provides more flexibility: it
inits the environment and then calls g.execute_shell_commands. See the source code in leoGlobals.py for details. For the ultimate in flexibility, use subprocess.popen.
EKR