File tree Expand file tree Collapse file tree 3 files changed +21
-6
lines changed
src/infra/engines/providers Expand file tree Collapse file tree 3 files changed +21
-6
lines changed Original file line number Diff line number Diff line change @@ -11,8 +11,13 @@ import { metadata } from './metadata.js';
1111 */
1212async function isCliInstalled ( command : string ) : Promise < boolean > {
1313 try {
14- await execa ( command , [ '--version' ] , { timeout : 3000 , reject : false } ) ;
15- return true ;
14+ const result = await execa ( command , [ '--version' ] , { timeout : 3000 , reject : false } ) ;
15+ if ( typeof result . exitCode === 'number' && result . exitCode === 0 ) return true ;
16+ const out = `${ result . stdout ?? '' } \n${ result . stderr ?? '' } ` ;
17+ if ( / n o t r e c o g n i z e d a s a n i n t e r n a l o r e x t e r n a l c o m m a n d / i. test ( out ) ) return false ;
18+ if ( / c o m m a n d n o t f o u n d / i. test ( out ) ) return false ;
19+ if ( / N o s u c h f i l e o r d i r e c t o r y / i. test ( out ) ) return false ;
20+ return false ;
1621 } catch {
1722 return false ;
1823 }
Original file line number Diff line number Diff line change @@ -21,8 +21,13 @@ async function resolveCodexHome(codexHome?: string): Promise<string> {
2121 */
2222async function isCliInstalled ( command : string ) : Promise < boolean > {
2323 try {
24- await execa ( command , [ '--version' ] , { timeout : 3000 , reject : false } ) ;
25- return true ;
24+ const result = await execa ( command , [ '--version' ] , { timeout : 3000 , reject : false } ) ;
25+ if ( typeof result . exitCode === 'number' && result . exitCode === 0 ) return true ;
26+ const out = `${ result . stdout ?? '' } \n${ result . stderr ?? '' } ` ;
27+ if ( / n o t r e c o g n i z e d a s a n i n t e r n a l o r e x t e r n a l c o m m a n d / i. test ( out ) ) return false ;
28+ if ( / c o m m a n d n o t f o u n d / i. test ( out ) ) return false ;
29+ if ( / N o s u c h f i l e o r d i r e c t o r y / i. test ( out ) ) return false ;
30+ return false ;
2631 } catch {
2732 return false ;
2833 }
Original file line number Diff line number Diff line change @@ -11,8 +11,13 @@ import { metadata } from './metadata.js';
1111 */
1212async function isCliInstalled ( command : string ) : Promise < boolean > {
1313 try {
14- await execa ( command , [ '--version' ] , { timeout : 3000 , reject : false } ) ;
15- return true ;
14+ const result = await execa ( command , [ '--version' ] , { timeout : 3000 , reject : false } ) ;
15+ if ( typeof result . exitCode === 'number' && result . exitCode === 0 ) return true ;
16+ const out = `${ result . stdout ?? '' } \n${ result . stderr ?? '' } ` ;
17+ if ( / n o t r e c o g n i z e d a s a n i n t e r n a l o r e x t e r n a l c o m m a n d / i. test ( out ) ) return false ;
18+ if ( / c o m m a n d n o t f o u n d / i. test ( out ) ) return false ;
19+ if ( / N o s u c h f i l e o r d i r e c t o r y / i. test ( out ) ) return false ;
20+ return false ;
1621 } catch {
1722 return false ;
1823 }
You can’t perform that action at this time.
0 commit comments