Files
orca/config/scripts/script-child-process.mjs
T
OrcaWinandm4air 1882458f44 ci: scope orcad smoke and parallelize Linux packages (#23314)
* ci: scope orcad smoke and parallelize Linux package formats

* ci: validate packaging when its copy dependency changes

---------

Co-authored-by: m4air <m4air@m4airs-Air.localdomain>
2026-09-26 20:44:15 -07:00

36 lines
1.0 KiB
JavaScript

import { build } from 'esbuild'
import { mkdtempSync, rmSync } from 'node:fs'
import { tmpdir } from 'node:os'
import { join, resolve } from 'node:path'
import { pathToFileURL } from 'node:url'
const root = resolve(import.meta.dirname, '../..')
const temporary = mkdtempSync(join(tmpdir(), 'orca-script-child-process-'))
const output = join(temporary, 'child-process.mjs')
let implementation
try {
await build({
stdin: {
contents: [
`export { runProcessSync, spawnProcess } from ${JSON.stringify(join(root, 'src/shared/child-process/run-process.ts'))}`
].join('\n'),
resolveDir: root,
sourcefile: 'script-child-process-entry.ts'
},
bundle: true,
platform: 'node',
target: 'node20',
format: 'esm',
outfile: output,
logLevel: 'silent'
})
implementation = await import(pathToFileURL(output).href)
} finally {
rmSync(temporary, { recursive: true, force: true })
}
export const runProcessSync = implementation.runProcessSync
export const spawnProcess = implementation.spawnProcess