File tree Expand file tree Collapse file tree 1 file changed +9
-1
lines changed
Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -3,6 +3,8 @@ import { ILogger } from '../common/logger';
33import * as utils from '../common/utilities' ;
44
55export class NativeScriptCli {
6+ private static CLI_OUTPUT_VERSION_REGEXP = / ^ (?: \d + \. ) { 2 } \d + .* ?$ / m;
7+
68 private _path : string ;
79 private _shellPath : string ;
810 private _logger : ILogger ;
@@ -24,7 +26,8 @@ export class NativeScriptCli {
2426
2527 public executeGetVersion ( ) : string {
2628 try {
27- return this . executeSync ( [ '--version' ] , undefined ) ;
29+ const versionOutput = this . executeSync ( [ '--version' ] , undefined ) ;
30+ return this . getVersionFromCLIOutput ( versionOutput )
2831 } catch ( e ) {
2932 this . _logger . log ( e ) ;
3033
@@ -58,4 +61,9 @@ export class NativeScriptCli {
5861
5962 return child ;
6063 }
64+
65+ private getVersionFromCLIOutput ( commandOutput : string ) : string {
66+ const matches = commandOutput . match ( NativeScriptCli . CLI_OUTPUT_VERSION_REGEXP ) ;
67+ return matches && matches [ 0 ] ;
68+ }
6169}
You can’t perform that action at this time.
0 commit comments