eiginn / coreemu

Automatically exported from code.google.com/p/coreemu
BSD 2-Clause "Simplified" License
0 stars 1 forks source link

execute Python script option should allow for command-line parameters and blocking scripts #230

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Command-line parameters for a Python script may be specified using the 
"core-daemon -e '/path/to/myscript.py -myargs'" syntax. A new menu item is 
needed "Execute Python Script (with arguments)..." (or ideally a checkbox in 
the File Open dialog) to allow specifying arguments from the GUI.

If the script blocks, the GUI will not connect, because CORE is waiting for the 
script to finish in order to send a Register Message back to the GUI.

One solution would be to have scripts block until ready for GUI connection 
(sending all objects to GUI) and then fork a new process. A better solution 
would be to always fork and run Python scripts in another thread; somehow the 
script would need to signal to the daemon that it is OK for the GUI to connect.

Original issue reported on code.google.com by ahrenh...@gmail.com on 28 Oct 2013 at 4:56

GoogleCodeExporter commented 9 years ago
tested forking from execfile() and control is not returned to the parent, so 
that is not actually an option

Original comment by ahrenh...@gmail.com on 28 Oct 2013 at 6:04

GoogleCodeExporter commented 9 years ago
comment added to core-daemon:
                # TODO: Script may not return; run in separate thread here.
                #       Wait for some configurable timeout period, then check
                #       for new session below. Wait for session to enter
                #       the runtime state, then send back the register message.
                execfile(scriptname, {'server': server})

Original comment by ahrenh...@gmail.com on 28 Oct 2013 at 6:22

GoogleCodeExporter commented 9 years ago
fixed in r517 (run scripts in background thread) and r515 (added "Execute 
Python script with options..." menu item)

Original comment by ahrenh...@gmail.com on 29 Jul 2014 at 2:09