(state: BackState, launchInfo: LaunchInfo, id: string, name: string)
| 2671 | } |
| 2672 | |
| 2673 | function 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 | |
| 2710 | function runAddAppFactory(state: BackState) { |
| 2711 | return (launchInfo: LaunchInfo): ManagedChildProcess => { |
no test coverage detected