MCPcopy Create free account
hub / github.com/TanStack/query / run

Function run

examples/lit/ssr/scripts/dev.mjs:21–46  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

19}
20
21async function run() {
22 runBuild()
23
24 const server = spawn(tsxCommand, ['./server/index.mjs'], {
25 cwd,
26 stdio: 'inherit',
27 })
28
29 const stopServer = (signal) => {
30 if (server.exitCode === null) {
31 server.kill(signal)
32 }
33 }
34
35 process.on('SIGINT', () => stopServer('SIGINT'))
36 process.on('SIGTERM', () => stopServer('SIGTERM'))
37
38 const outcome = await Promise.race([
39 once(server, 'error').then(([error]) => {
40 throw error
41 }),
42 once(server, 'exit').then(([code]) => ({ code })),
43 ])
44
45 process.exitCode = outcome.code ?? 0
46}
47
48run().catch((error) => {
49 console.error(error)

Callers 1

dev.mjsFile · 0.70

Calls 2

runBuildFunction · 0.85
stopServerFunction · 0.85

Tested by

no test coverage detected