diff options
author | Fabio Berger <me@fabioberger.com> | 2018-07-02 20:20:42 +0800 |
---|---|---|
committer | Fabio Berger <me@fabioberger.com> | 2018-07-02 20:20:42 +0800 |
commit | e553ef83de473fd493f32158bc61e39778acc623 (patch) | |
tree | c2dfa95576821958d731aca7a49803870c15c852 /packages/monorepo-scripts | |
parent | a619949a56937d29b3e7463812e9ea8515d21126 (diff) | |
download | dexon-0x-contracts-e553ef83de473fd493f32158bc61e39778acc623.tar.gz dexon-0x-contracts-e553ef83de473fd493f32158bc61e39778acc623.tar.zst dexon-0x-contracts-e553ef83de473fd493f32158bc61e39778acc623.zip |
Git command outputs logs to stdErr so only way to check for errors if with try/catch
Diffstat (limited to 'packages/monorepo-scripts')
-rw-r--r-- | packages/monorepo-scripts/src/utils/utils.ts | 14 |
1 files changed, 8 insertions, 6 deletions
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<void> { - 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<void> { - 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}`); }, |