File tree Expand file tree Collapse file tree 1 file changed +19
-1
lines changed Expand file tree Collapse file tree 1 file changed +19
-1
lines changed Original file line number Diff line number Diff line change @@ -82,11 +82,29 @@ class OnePassword {
82
82
return compareVersions ( '2.2.0' , data ) >= 0
83
83
}
84
84
85
+ async _completeIntegrationPrompt ( command ) {
86
+ try {
87
+ const process = new ProcessSpawner ( command , [ 'whoami' ] , { } , 1000 )
88
+ await process . executeSyncInAsyncContext ( )
89
+ } catch ( e ) {
90
+ if ( e . toString ( ) . includes ( 'Would you like to turn on the 1Password app integration?' ) ) {
91
+ console . warn ( 'disabling 1password app integration' )
92
+ try {
93
+ const retryProcess = new ProcessSpawner ( command , [ 'whoami' ] , { } , 1000 )
94
+ await retryProcess . executeSyncInAsyncContext ( 'n\n' )
95
+ } catch ( e ) {
96
+ console . warn ( e )
97
+ }
98
+ }
99
+ }
100
+ return true
101
+ }
102
+
85
103
// Checks if 1Password integration is configured properly by trying to
86
104
// obtain a valid 1Password-CLI tool path.
87
105
async checkIfConfigured ( ) {
88
106
this . path = await this . _getToolPath ( )
89
- return this . path != null && ( await this . _checkVersion ( this . path ) )
107
+ return this . path != null && ( await this . _checkVersion ( this . path ) ) && ( await this . _completeIntegrationPrompt ( this . path ) )
90
108
}
91
109
92
110
// Returns current 1Password-CLI status. If we have a session key, then
You can’t perform that action at this time.
0 commit comments