Skip to content

Commit

Permalink
add env and run the bin as-is
Browse files Browse the repository at this point in the history
  • Loading branch information
cnuss committed Jun 4, 2024
1 parent f1a5d90 commit c08435c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/internal/bootstrap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export const bootstrap = async (): Promise<void> => {

const { childProcess, bin, endpoint } = await endpointSpawn(
_HANDLER,
IS_OFFLINE === "true"
process.env
);

try {
Expand Down
12 changes: 6 additions & 6 deletions src/internal/proxy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ const waitForEndpoint = async (

export const endpointSpawn = async (
handler: string,
offline: boolean
env?: NodeJS.ProcessEnv
): Promise<{
childProcess?: ChildProcess;
bin?: string;
Expand All @@ -105,19 +105,19 @@ export const endpointSpawn = async (
if (bin && endpoint) {
log("Starting child process", { bin });

const subcommand = offline ? "dev" : "start";
info(`Running: \`${bin}\``);

info(`Running: \`${bin} ${subcommand}\``);

childProcess = spawn(bin, [subcommand], {
const cmds = bin.split(" ");
childProcess = spawn(cmds[0], cmds.slice(1), {
detached: true,
stdio: "inherit",
env: env,
});

// TODO Decide if we should do this...
childProcess.unref();

log("Started child process", { bin, subcommand, pid: childProcess.pid });
log("Started child process", { cmds, pid: childProcess.pid });
}

endpoint = endpoint ? new URL(endpoint) : undefined;
Expand Down

0 comments on commit c08435c

Please sign in to comment.