@@ -11,7 +11,6 @@ import {
1111import { BumpType , LockStepVersionPolicy } from '../../api/VersionPolicy' ;
1212import { VersionPolicyConfiguration } from '../../api/VersionPolicyConfiguration' ;
1313import { RushConfiguration } from '../../api/RushConfiguration' ;
14- import { Utilities } from '../../utilities/Utilities' ;
1514import { VersionControl } from '../../utilities/VersionControl' ;
1615import { VersionMismatchFinder } from '../../api/VersionMismatchFinder' ;
1716import { RushCommandLineParser } from '../RushCommandLineParser' ;
@@ -91,15 +90,22 @@ export class VersionAction extends BaseRushAction {
9190 }
9291
9392 protected run ( ) : Promise < void > {
93+ // try to get the user email
94+ const userEmail : string | undefined = GitPolicy . getUserEmail ( this . rushConfiguration ) ;
95+
96+ if ( ! userEmail ) {
97+ return Promise . reject ( undefined ) ;
98+ }
99+
94100 if ( ! this . _bypassPolicy . value ) {
95- if ( ! GitPolicy . check ( this . rushConfiguration ) ) {
96- process . exit ( 1 ) ;
97- return Promise . resolve ( ) ;
101+ if ( ! GitPolicy . check ( this . rushConfiguration , userEmail ) ) {
102+ return Promise . reject ( undefined ) ;
98103 }
99104 }
100105 this . _validateInput ( ) ;
101106
102- this . _versionManager = new VersionManager ( this . rushConfiguration , this . _getUserEmail ( ) ) ;
107+ this . _versionManager = new VersionManager ( this . rushConfiguration , userEmail ) ;
108+
103109 if ( this . _ensureVersionPolicy . value ) {
104110 this . _overwritePolicyVersionIfNeeded ( ) ;
105111 const tempBranch : string = 'version/ensure-' + new Date ( ) . getTime ( ) ;
@@ -188,11 +194,6 @@ export class VersionAction extends BaseRushAction {
188194 }
189195 }
190196
191- private _getUserEmail ( ) : string {
192- return Utilities . executeCommandAndCaptureOutput ( 'git' ,
193- [ 'config' , 'user.email' ] , '.' ) . trim ( ) ;
194- }
195-
196197 private _gitProcess ( tempBranch : string ) : void {
197198 // Validate the result before commit.
198199 this . _validateResult ( ) ;
0 commit comments