App Launchers
Stay organized with collections
Save and categorize content based on your preferences.
The app launcher framework is used to run an executable on a given platform,
allowing its output/results to be used by other scripts or tools.
Making an App Launcher
In order to use this framework for your platform, there must be a method called
"GetLauncher()" in the PlatformConfig class that your platform's
"gyp_configuration.py" file refers to. It should load and return a module
containing a class called "Launcher." This class must inherit from the
AbstractLauncher class in abstract_launcher.py,
and must implement at minimum the following abstract methods:
- Run(): Runs the executable, logs its output, and returns its return code.
Generally, any app installation work is also done in this method.
- Kill(): Kills the currently running executable and cleans up any leftover
resources such as threads, processes, etc.
Once the above steps are implemented, tools that use this framework, such as
Starboard's unit test runner, should work
properly for your platform. For an example of a Launcher class, see
this Linux implementation. For an example
of the corresponding "GetLauncher()" method, see
this gyp_configuration.py file.
Using an App Launcher
In order to use this framework in a Python tool, it must import
abstract_launcher.py and call "abstract_launcher.LauncherFactory()." This
method returns a Launcher object from the platform specified by its "platform"
argument. To run the launcher, call its "Run()" method, and to stop it, call
its "Kill()" method. If your tools need to access the Launcher's output while
the executable is still running, have it start "Run()" in a separate thread;
this will allow the main thread to easily read from the Launcher's output file.
For an example of creating and using a Launcher, see
this example.
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-09-03 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-09-03 UTC."],[[["\u003cp\u003eThe app launcher framework enables execution of platform-specific executables and utilizes their output in other tools or scripts.\u003c/p\u003e\n"],["\u003cp\u003ePlatforms need a \u003ccode\u003eGetLauncher()\u003c/code\u003e method within their \u003ccode\u003ePlatformConfig\u003c/code\u003e class and a \u003ccode\u003eLauncher\u003c/code\u003e class inheriting from \u003ccode\u003eAbstractLauncher\u003c/code\u003e to integrate with the framework.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003eLauncher\u003c/code\u003e implementations must include \u003ccode\u003eRun()\u003c/code\u003e for execution and cleanup and \u003ccode\u003eKill()\u003c/code\u003e for process termination and resource management.\u003c/p\u003e\n"],["\u003cp\u003eTools using the framework utilize \u003ccode\u003eLauncherFactory()\u003c/code\u003e to obtain a platform-specific \u003ccode\u003eLauncher\u003c/code\u003e object and then call \u003ccode\u003eRun()\u003c/code\u003e and \u003ccode\u003eKill()\u003c/code\u003e for control.\u003c/p\u003e\n"],["\u003cp\u003eFor concurrent output access, execute \u003ccode\u003eRun()\u003c/code\u003e in a separate thread, allowing the main thread to read from the launcher's output file.\u003c/p\u003e\n"]]],["The app launcher framework enables running executables and utilizing their results across platforms. To implement it, define a `GetLauncher()` method in the `PlatformConfig` class that returns a `Launcher` class. This `Launcher` must inherit from `AbstractLauncher` and implement `Run()` to execute and log the output, and `Kill()` to stop it. Tools utilize the framework by importing `abstract_launcher.py`, creating a `Launcher` object with `LauncherFactory()`, then using its `Run()` and `Kill()` methods.\n"],null,["The app launcher framework is used to run an executable on a given platform,\nallowing its output/results to be used by other scripts or tools.\n\nMaking an App Launcher\n\nIn order to use this framework for your platform, there must be a method called\n\"GetLauncher()\" in the PlatformConfig class that your platform's\n\"gyp_configuration.py\" file refers to. It should load and return a module\ncontaining a class called \"Launcher.\" This class must inherit from the\nAbstractLauncher class in [abstract_launcher.py](../../abstract_launcher.py),\nand must implement at minimum the following abstract methods:\n\n- Run(): Runs the executable, logs its output, and returns its return code. Generally, any app installation work is also done in this method.\n- Kill(): Kills the currently running executable and cleans up any leftover resources such as threads, processes, etc.\n\nOnce the above steps are implemented, tools that use this framework, such as\n[Starboard's unit test runner](../../testing/test_runner.py), should work\nproperly for your platform. For an example of a Launcher class, see\n[this Linux implementation](../../../linux/shared/launcher.py). For an example\nof the corresponding \"GetLauncher()\" method, see\n[this gyp_configuration.py file](../../../linux/shared/gyp_configuration.py).\n\nUsing an App Launcher\n\nIn order to use this framework in a Python tool, it must import\nabstract_launcher.py and call \"abstract_launcher.LauncherFactory().\" This\nmethod returns a Launcher object from the platform specified by its \"platform\"\nargument. To run the launcher, call its \"Run()\" method, and to stop it, call\nits \"Kill()\" method. If your tools need to access the Launcher's output while\nthe executable is still running, have it start \"Run()\" in a separate thread;\nthis will allow the main thread to easily read from the Launcher's output file.\nFor an example of creating and using a Launcher, see\n[this example](../../example/app_launcher_client.py)."]]