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

Function run

examples/lit/pagination/scripts/dev.mjs:50–75  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

48}
49
50async function run() {
51 const api = start('api', process.execPath, ['./server/index.mjs'])
52 const web = start('web', viteCommand, [], {
53 VITE_PAGINATION_API_PORT: String(API_PORT),
54 })
55
56 const shutdown = async () => {
57 await Promise.all([stop(web), stop(api)])
58 }
59
60 process.on('SIGINT', shutdown)
61 process.on('SIGTERM', shutdown)
62
63 const [winner] = await Promise.race([
64 once(api, 'exit').then(([code]) => ({ name: 'api', code })),
65 once(web, 'exit').then(([code]) => ({ name: 'web', code })),
66 ])
67
68 await shutdown()
69
70 if (winner.code !== 0 && winner.code !== null) {
71 process.exitCode = winner.code
72 } else {
73 process.exitCode = 1
74 }
75}
76
77run().catch((error) => {
78 console.error(error)

Callers 1

dev.mjsFile · 0.70

Calls 2

startFunction · 0.85
shutdownFunction · 0.85

Tested by

no test coverage detected