File tree Expand file tree Collapse file tree 2 files changed +15
-5
lines changed Expand file tree Collapse file tree 2 files changed +15
-5
lines changed Original file line number Diff line number Diff line change 1- import { type ChildProcessWithoutNullStreams , spawn } from 'node:child_process'
1+ import { type ChildProcess , spawn } from 'node:child_process'
22import { DeferredPromise } from '@open-draft/deferred-promise'
33import { invariant } from '@epic-web/invariant'
44
@@ -11,7 +11,7 @@ export interface AppProcessOptions {
1111export const kUrl = Symbol ( 'kUrl' )
1212
1313export class AppProcess {
14- private io ?: ChildProcessWithoutNullStreams
14+ private io ?: ChildProcess
1515 private controller : AbortController
1616 private [ kUrl ] ?: URL
1717
@@ -30,7 +30,7 @@ export class AppProcess {
3030 return url
3131 }
3232
33- public async launch ( ) : Promise < ChildProcessWithoutNullStreams > {
33+ public async launch ( ) : Promise < ChildProcess > {
3434 const [ command , ...args ] = this . options . command . split ( ' ' )
3535
3636 invariant (
Original file line number Diff line number Diff line change 1- import type { ChildProcessWithoutNullStreams } from 'node:child_process'
1+ import type { ChildProcess } from 'node:child_process'
22import { AppProcess , kUrl } from './app-process.js'
33import { waitForPort } from './wait-for-port.js'
44
@@ -10,6 +10,11 @@ export interface DefineLauncherOptions<Context> {
1010 */
1111 extends ?: Launcher
1212
13+ /**
14+ * Run the launcher in debug mode.
15+ */
16+ debug ?: boolean
17+
1318 /**
1419 * Define a context object exposed to the other launcher methods.
1520 *
@@ -66,7 +71,7 @@ export interface DefineLauncherOptions<Context> {
6671 url : ( options : {
6772 context : Context
6873 env : Record < string , string >
69- appProcess : ChildProcessWithoutNullStreams
74+ appProcess : ChildProcess
7075 } ) => string | URL | Promise < string | URL >
7176}
7277
@@ -108,6 +113,11 @@ export function defineLauncher<Context>(
108113 } )
109114 const childProcess = await app . launch ( )
110115
116+ if ( options ?. debug ) {
117+ childProcess . stdout ?. pipe ( process . stdout )
118+ childProcess . stderr ?. pipe ( process . stderr )
119+ }
120+
111121 // Wait for the provided application URL to be up.
112122 const url = await options . url ( {
113123 context,
You can’t perform that action at this time.
0 commit comments