Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: unable to kill fuels dev with pnpm #3508

Merged
merged 12 commits into from
Jan 6, 2025
7 changes: 7 additions & 0 deletions .changeset/thin-planes-cover.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
"@fuel-ts/account": patch
"fuels": patch
"create-fuels": patch
petertonysmith94 marked this conversation as resolved.
Show resolved Hide resolved
---

fix: unable to kill `fuels dev` with `pnpm`
2 changes: 1 addition & 1 deletion .github/workflows/pr-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
name: "Release PR to npm"
runs-on: ubuntu-latest
# comment out if:false to enable release PR to npm
if: false
# if: false
petertonysmith94 marked this conversation as resolved.
Show resolved Hide resolved
permissions: write-all
steps:
- name: Checkout
Expand Down
16 changes: 12 additions & 4 deletions packages/account/src/test-utils/launchNode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ export type LaunchNodeOptions = {
* */
snapshotConfig?: SnapshotConfigs;
includeInitialState?: boolean;
killProcessOnExit?: boolean;
};

export type LaunchNodeResult = Promise<{
Expand Down Expand Up @@ -143,6 +144,7 @@ export const launchNode = async ({
basePath,
snapshotConfig = defaultSnapshotConfigs,
includeInitialState = false,
killProcessOnExit = false,
}: LaunchNodeOptions = {}): LaunchNodeResult =>
// eslint-disable-next-line no-async-promise-executor
new Promise(async (resolve, reject) => {
Expand Down Expand Up @@ -248,9 +250,6 @@ export const launchNode = async ({
}
};

child.on('error', removeSideffects);
child.on('exit', removeSideffects);

const childState = {
isDead: false,
};
Expand Down Expand Up @@ -331,5 +330,14 @@ export const launchNode = async ({
process.on('beforeExit', cleanup);
process.on('uncaughtException', cleanup);

child.on('error', reject);
child.on('exit', (code: number | null, _signal: NodeJS.Signals | null) => {
removeSideffects();
if (killProcessOnExit) {
process.exit(code);
}
});
child.on('error', (err: Error) => {
removeSideffects();
reject(err);
});
});
1 change: 1 addition & 0 deletions packages/fuels/src/cli/commands/dev/autoStartFuelCore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ export const autoStartFuelCore = async (config: FuelsConfig) => {
basePath: config.basePath,
fuelCorePath: config.fuelCorePath,
includeInitialState: true,
killProcessOnExit: true,
});

fuelCore = {
Expand Down
Loading