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';
3
3
import * as utils from '../common/utilities' ;
4
4
5
5
export class NativeScriptCli {
6
+ private static CLI_OUTPUT_VERSION_REGEXP = / ^ (?: \d + \. ) { 2 } \d + .* ?$ / m;
7
+
6
8
private _path : string ;
7
9
private _shellPath : string ;
8
10
private _logger : ILogger ;
@@ -24,7 +26,8 @@ export class NativeScriptCli {
24
26
25
27
public executeGetVersion ( ) : string {
26
28
try {
27
- return this . executeSync ( [ '--version' ] , undefined ) ;
29
+ const versionOutput = this . executeSync ( [ '--version' ] , undefined ) ;
30
+ return this . getVersionFromCLIOutput ( versionOutput )
28
31
} catch ( e ) {
29
32
this . _logger . log ( e ) ;
30
33
@@ -58,4 +61,9 @@ export class NativeScriptCli {
58
61
59
62
return child ;
60
63
}
64
+
65
+ private getVersionFromCLIOutput ( commandOutput : string ) : string {
66
+ const matches = commandOutput . match ( NativeScriptCli . CLI_OUTPUT_VERSION_REGEXP ) ;
67
+ return matches && matches [ 0 ] ;
68
+ }
61
69
}
You can’t perform that action at this time.
0 commit comments