File tree Expand file tree Collapse file tree 1 file changed +8
-8
lines changed Expand file tree Collapse file tree 1 file changed +8
-8
lines changed Original file line number Diff line number Diff line change @@ -62,21 +62,21 @@ export class GoogleCloudPlatformAuth implements Authenticator {
62
62
}
63
63
64
64
private updateAccessToken ( config : Config ) : void {
65
- let cmd = config [ 'cmd-path' ] ;
65
+ const cmd = config [ 'cmd-path' ] ;
66
66
if ( ! cmd ) {
67
67
throw new Error ( 'Token is expired!' ) ;
68
68
}
69
- // Wrap cmd in quotes to make it cope with spaces in path
70
- cmd = `" ${ cmd } "` ;
71
- const args = config [ 'cmd-args' ] ;
72
- if ( args ) {
73
- cmd = cmd + ' ' + args ;
74
- }
69
+ const args = ( config [ ' cmd-args' ] ? config [ 'cmd-args' ] . split ( ' ' ) : [ ] ) . map ( ( arg : string ) : string => {
70
+ if ( arg [ 0 ] === "'" || arg [ 0 ] === '"' ) {
71
+ return arg . substring ( 1 , arg . length - 1 ) ;
72
+ }
73
+ return arg ;
74
+ } ) ;
75
75
// TODO: Cache to file?
76
76
// TODO: do this asynchronously
77
77
let output : any ;
78
78
try {
79
- output = proc . execSync ( cmd ) ;
79
+ output = proc . execFileSync ( cmd , args ) ;
80
80
} catch ( err ) {
81
81
throw new Error ( 'Failed to refresh token: ' + ( err as Error ) . message ) ;
82
82
}
You can’t perform that action at this time.
0 commit comments