bin.ts 791 B

12345678910111213141516171819202122232425
  1. /** Thin executable/importable entry for the provider-private runner core. */
  2. import { consumeRunnerSelection } from './runner-launch.ts'
  3. import { reportSpawnRunnerFailure, runSpawnRunner } from './spawn-runner.ts'
  4. /**
  5. * Run a selector already removed by a packaging bootstrap.
  6. * @param selection - private runner selector or Linux launch-request locator.
  7. */
  8. export async function runSelectedSubprocessRunner(selection: string): Promise<void> {
  9. try {
  10. await runSpawnRunner(selection, process.argv.slice(2))
  11. } catch (error) {
  12. await reportSpawnRunnerFailure(selection, error)
  13. }
  14. }
  15. if (import.meta.main) {
  16. const selection = consumeRunnerSelection()
  17. if (selection === undefined) {
  18. process.exitCode = 127
  19. } else {
  20. void runSelectedSubprocessRunner(selection)
  21. }
  22. }