File tree Expand file tree Collapse file tree 2 files changed +19
-16
lines changed
Expand file tree Collapse file tree 2 files changed +19
-16
lines changed Original file line number Diff line number Diff line change @@ -29,11 +29,16 @@ export class Model {
2929 const config = workspace . getConfiguration ( "svn" ) ;
3030 this . enabled = config . get ( "enabled" ) === true ;
3131
32- if ( this . enabled ) {
33- this . init ( ) ;
34- } else {
35- this . disable ( ) ;
36- }
32+ svn
33+ . isSvnAvailable ( )
34+ . then ( ( ) => {
35+ if ( this . enabled && svn . isSvnAvailable ( ) ) {
36+ this . init ( ) ;
37+ } else {
38+ this . disable ( ) ;
39+ }
40+ } )
41+ . catch ( ( ) => { } ) ;
3742 }
3843
3944 private init ( ) : void {
Original file line number Diff line number Diff line change @@ -9,10 +9,6 @@ interface CpOptions {
99}
1010
1111export class Svn {
12- constructor ( ) {
13- this . isSvnAvailable ( ) ;
14- }
15-
1612 async exec ( cwd : string , args : any [ ] , options : CpOptions = { } ) {
1713 if ( cwd ) {
1814 options . cwd = cwd ;
@@ -61,15 +57,17 @@ export class Svn {
6157 }
6258 }
6359
64- private isSvnAvailable ( ) {
60+ public async isSvnAvailable ( ) {
6561 return new Promise ( ( resolve , reject ) => {
66- this . exec ( "" , [ "--version" ] )
67- . then ( result => {
68- resolve ( ) ;
69- } )
70- . catch ( result => {
62+ cp . exec ( "svn --version" , ( error , stdout , stderr ) => {
63+ if ( error ) {
64+ console . log ( stderr ) ;
65+ window . showErrorMessage ( stderr ) ;
7166 reject ( ) ;
72- } ) ;
67+ }
68+
69+ resolve ( ) ;
70+ } ) ;
7371 } ) ;
7472 }
7573
You can’t perform that action at this time.
0 commit comments