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 {
1313 InfoItem ,
1414 IntegrationAddDetails ,
1515 IntegrationName ,
16+ IShellSpawnOptions ,
1617 ProjectIntegration ,
1718 ProjectPersonalizationDetails
1819} from '../../../definitions' ;
@@ -190,7 +191,25 @@ export class Integration extends BaseIntegration<ProjectIntegration> {
190191
191192 debug ( 'Getting config with Capacitor CLI: %O' , args ) ;
192193
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+
194213
195214 if ( ! output ) {
196215 debug ( 'Could not get config from Capacitor CLI (probably old version)' ) ;
You can’t perform that action at this time.
0 commit comments