From e553ef83de473fd493f32158bc61e39778acc623 Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Mon, 2 Jul 2018 14:20:42 +0200 Subject: Git command outputs logs to stdErr so only way to check for errors if with try/catch --- packages/monorepo-scripts/src/utils/utils.ts | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'packages/monorepo-scripts/src') diff --git a/packages/monorepo-scripts/src/utils/utils.ts b/packages/monorepo-scripts/src/utils/utils.ts index 7019f9241..4d3e2d709 100644 --- a/packages/monorepo-scripts/src/utils/utils.ts +++ b/packages/monorepo-scripts/src/utils/utils.ts @@ -103,20 +103,22 @@ export const utils = { return tagVersionByPackageName; }, async removeLocalTagAsync(tagName: string): Promise { - const result = await execAsync(`git tag -d ${tagName}`, { + try { + await execAsync(`git tag -d ${tagName}`, { cwd: constants.monorepoRootPath, }); - if (!_.isEmpty(result.stderr)) { - throw new Error(`Failed to delete local git tag. Got err: ${result.stderr}`); + } catch (err) { + throw new Error(`Failed to delete local git tag. Got err: ${err}`); } this.log(`Removed local tag: ${tagName}`); }, async removeRemoteTagAsync(tagName: string): Promise { - const result = await execAsync(`git push origin ${tagName}`, { + try { + await execAsync(`git push origin ${tagName}`, { cwd: constants.monorepoRootPath, }); - if (!_.isEmpty(result.stderr)) { - throw new Error(`Failed to delete remote git tag. Got err: ${result.stderr}`); + } catch (err) { + throw new Error(`Failed to delete remote git tag. Got err: ${err}`); } this.log(`Removed remote tag: ${tagName}`); }, -- cgit