Skip to content

A way to launch external processes/servers during startup or later, and automatic shutdown of these processes when app exits #163

Open
@GoogleCodeExporter

Description

@GoogleCodeExporter
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.

Use case 1
----------
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 "startup_processes" which would be a list 
of .exe, allowed would be relative paths (phpdesktop dir) or full paths.

Use case 2
----------
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.

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

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions