From 1e9b6526d94185c9082fb2a4e8bf9d80a3338f94 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A1n=20Jakub=20Nani=C5=A1ta?= Date: Thu, 9 May 2024 11:48:05 -0700 Subject: [PATCH] =?UTF-8?q?=F0=9F=AA=B2=20Exit=20with=20error=20code=20whe?= =?UTF-8?q?n=20simulation=20fails=20to=20start=20(#607)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .changeset/smart-coats-sing.md | 6 ++++++ packages/devtools-evm-hardhat/src/tasks/simulation/start.ts | 6 +++++- 2 files changed, 11 insertions(+), 1 deletion(-) create mode 100644 .changeset/smart-coats-sing.md diff --git a/.changeset/smart-coats-sing.md b/.changeset/smart-coats-sing.md new file mode 100644 index 000000000..0803998ee --- /dev/null +++ b/.changeset/smart-coats-sing.md @@ -0,0 +1,6 @@ +--- +"@layerzerolabs/devtools-evm-hardhat": patch +"@layerzerolabs/toolbox-hardhat": patch +--- + +Exit with error code when simulation fails to start diff --git a/packages/devtools-evm-hardhat/src/tasks/simulation/start.ts b/packages/devtools-evm-hardhat/src/tasks/simulation/start.ts index 2a5e72eeb..0fe9a1fa4 100644 --- a/packages/devtools-evm-hardhat/src/tasks/simulation/start.ts +++ b/packages/devtools-evm-hardhat/src/tasks/simulation/start.ts @@ -119,9 +119,13 @@ const action: ActionType = async ( // This is a very quick and dirty way to pass an optional --wait argument to docker compose up const additionalUpArgs: string[] = daemon ? ['--wait'] : [] - spawnSync('docker', ['compose', '-f', dockerComposePath, 'up', ...additionalUpArgs], { + const result = spawnSync('docker', ['compose', '-f', dockerComposePath, 'up', ...additionalUpArgs], { stdio: 'inherit', }) + + if (result.status !== 0) { + throw new Error(`docker compose up command failed with exit code ${result.status}`) + } } catch (error) { logger.error(`Failed to spawn docker compose up command for ${dockerComposePath}: ${error}`)