MCPcopy Create free account
hub / github.com/FlashpointProject/launcher / runGameService

Function runGameService

src/back/responses.ts:2673–2708  ·  view source on GitHub ↗
(state: BackState, launchInfo: LaunchInfo, id: string, name: string)

Source from the content-addressed store, hash-verified

2671}
2672
2673function runGameService(state: BackState, launchInfo: LaunchInfo, id: string, name: string): ManagedChildProcess {
2674 const dirname = path.dirname(launchInfo.gamePath);
2675 // Keep file path relative to cwd
2676 const proc = runService(
2677 state,
2678 id,
2679 name,
2680 '',
2681 {
2682 detached: false,
2683 cwd: launchInfo.cwd,
2684 noshell: !!launchInfo.noshell,
2685 env: launchInfo.env
2686 },
2687 {
2688 path: dirname,
2689 filename: createCommand(launchInfo.gamePath, launchInfo.useWine, !!launchInfo.noshell),
2690 // Don't escape args if we're not using a shell.
2691 arguments: launchInfo.noshell
2692 ? typeof launchInfo.gameArgs == 'string'
2693 ? [launchInfo.gameArgs]
2694 : launchInfo.gameArgs
2695 : escapeArgsForShell(launchInfo.gameArgs),
2696 kill: true
2697 }
2698 );
2699
2700 // Remove game service when it exits
2701 proc.on('change', () => {
2702 if (proc.getState() === ProcessState.STOPPED) {
2703 removeService(state, proc.id);
2704 }
2705 });
2706
2707 return proc;
2708}
2709
2710function runAddAppFactory(state: BackState) {
2711 return (launchInfo: LaunchInfo): ManagedChildProcess => {

Callers 2

runAddAppFactoryFunction · 0.85
runGameFactoryFunction · 0.85

Calls 6

runServiceFunction · 0.90
escapeArgsForShellFunction · 0.90
removeServiceFunction · 0.90
createCommandFunction · 0.70
onMethod · 0.65
getStateMethod · 0.45

Tested by

no test coverage detected