File tree Expand file tree Collapse file tree 1 file changed +20
-1
lines changed
packages/@ionic/cli/src/lib/integrations/capacitor Expand file tree Collapse file tree 1 file changed +20
-1
lines changed Original file line number Diff line number Diff line change @@ -13,6 +13,7 @@ import {
13
13
InfoItem ,
14
14
IntegrationAddDetails ,
15
15
IntegrationName ,
16
+ IShellSpawnOptions ,
16
17
ProjectIntegration ,
17
18
ProjectPersonalizationDetails
18
19
} from '../../../definitions' ;
@@ -190,7 +191,25 @@ export class Integration extends BaseIntegration<ProjectIntegration> {
190
191
191
192
debug ( 'Getting config with Capacitor CLI: %O' , args ) ;
192
193
193
- const output = await this . e . shell . cmdinfo ( 'capacitor' , args , { cwd : this . root } ) ;
194
+ let output = undefined ;
195
+ try {
196
+ output = await ( async ( _command : string , _args : readonly string [ ] = [ ] , opts : IShellSpawnOptions = { } ) => {
197
+ try {
198
+ const proc = await this . e . shell . createSubprocess ( _command , _args , opts ) ;
199
+ const out = await proc . output ( ) ;
200
+ return out . split ( '\n' ) . join ( ' ' ) . trim ( ) ;
201
+ } catch ( err ) {
202
+ throw err ;
203
+ }
204
+ } ) ( 'capacitor' , args , { cwd : this . root } )
205
+ } catch ( error ) {
206
+ if ( ( error as any ) . code === 'ERR_SUBPROCESS_COMMAND_NOT_FOUND' ) {
207
+ throw new Error ( `Capacitor command not found. Is the Capacitor CLI installed? (npm i -D @capacitor/cli)` ) ;
208
+ } else {
209
+ throw new Error ( ( error as any ) . message ) ;
210
+ }
211
+ }
212
+
194
213
195
214
if ( ! output ) {
196
215
debug ( 'Could not get config from Capacitor CLI (probably old version)' ) ;
You can’t perform that action at this time.
0 commit comments