fix: respect options

This commit is contained in:
cha0s 2024-02-17 07:01:31 -06:00
parent 8ae2f59e19
commit 86d088a98e

View File

@ -131,9 +131,7 @@ export async function startServer({
if (beforeBuild) {
await beforeBuild({path, task});
}
const server = spawnWith(
[await binaryPath('flecks', '@flecks/build'), 'build', ...args],
{
const spawnOptions = {
stdio: 'pipe',
...opts,
env: {
@ -147,12 +145,15 @@ export async function startServer({
NODE_PATH: join(FLECKS_CORE_ROOT, '..', '..', 'node_modules'),
...opts.env,
},
},
};
const server = spawnWith(
[await binaryPath('flecks', '@flecks/build'), 'build', ...args],
spawnOptions,
);
server.on('exit', async () => {
socketServer.close();
});
if (failOnErrorCode) {
if (failOnErrorCode && 'pipe' === spawnOptions.stdio) {
const stdio = pipesink(server.stderr.pipe(server.stdout.pipe(new PassThrough())));
server.on('exit', async (code) => {
if (!server.done && 0 !== code) {