From 571cbb3e631611f7f252a541aabbf58c3adca782 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Wouts?= Date: Fri, 9 Jul 2021 08:37:39 +1000 Subject: [PATCH] Explicitly exit the process on success This fixes an issue where the Vite dev server didn't stop properly. Fixes #47. --- package.json | 3 ++- src/commands/shoot.ts | 6 ++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index 53e2592..fb14dde 100644 --- a/package.json +++ b/package.json @@ -9,7 +9,8 @@ }, "scripts": { "build": "rimraf dist && rollup -c && chmod +x dist/lib/cli.js && cp package.json dist/", - "dev": "ts-node-dev src/cli.ts", + "dev": "ts-node src/cli.ts", + "dev:watch": "ts-node-dev src/cli.ts", "release": "yarn build && cd dist && yarn publish --non-interactive" }, "dependencies": { diff --git a/src/commands/shoot.ts b/src/commands/shoot.ts index bb9e192..76dfddb 100644 --- a/src/commands/shoot.ts +++ b/src/commands/shoot.ts @@ -22,8 +22,9 @@ export async function shootCommand(options: { screenshotPaths = await config.shooter.shoot(`http://localhost:${port}`); } catch (e) { return fail(e.message); + } finally { + await stopRenderer(); } - await stopRenderer(); if (options.push) { const git = simpleGit(); await git.addConfig("user.name", "🤖 Viteshot"); @@ -46,5 +47,6 @@ export async function shootCommand(options: { info("✅ Screenshots have not changed."); } } - return info("All done."); + info("All done."); + return process.exit(0); }