Description
User can execute applications using php's system() command or similar, but there is no easy way to end long running processes when phpdesktop application closes.
Option 1 - "execute_on_startup" in settings.json
User wants to run node.js server along with phpdesktop. That server should start when phpdesktop starts and shut down automatically when phpdesktop app exits.
Solution: In settings.json add option "execute_on_startup" which would be a list of .exe, allowed would be relative paths (phpdesktop dir) or full paths.
There is also an idea for "execute_on_shutdown" option, see Issue #186.
Option 2 - new JS API: phpdesktop.LaunchProcess()
While app runs user wants to run an external process. Currently this can be done using XMLHttpRequest to a php script that calls php's system() command or similar. Unfortunately there is no easy way to end this process when phpdesktop app exits. For example this process runs a long task, but user exits application early, so this process should be killed automatically.
Solution: Add new function to JavascriptApi: LaunchProcess(). It should have some options whether the app window should be hidden. Use the ShellExecuteEx function and save process handle (SHELLEXECUTEINFO.hProcess) for later to end the process when app exits.
ShellExecuteEx:
https://msdn.microsoft.com/en-us/library/windows/desktop/bb762154(v=vs.85).aspx
SHELLEXECUTEINFO:
https://msdn.microsoft.com/en-us/library/windows/desktop/bb759784(v=vs.85).aspx
Original issue reported on code.google.com by [email protected]
on 7 Mar 2015 at 8:34