@@ -6768,20 +6768,22 @@ async function downloadCLI(osPlatform) {
67686768 case 'win32' :
67696769 return await tc . extractZip ( await tc . downloadTool ( urls [ osPlatform ] ) ) ;
67706770 case 'darwin' :
6771- // Use brew info --json to check if stackql is installed
6771+ // Check if stackql is already installed using brew list --formula
67726772 core . info ( `Checking if stackql is already installed` ) ;
67736773 try {
6774- const brewInfo = execSync ( 'brew info stackql --json' , { encoding : 'utf-8' } ) ;
6775- const brewInfoJson = JSON . parse ( brewInfo ) ;
6776- if ( brewInfoJson [ 0 ] . installed . length > 0 ) {
6774+ const installedFormulas = execSync ( 'brew list --formula' , { encoding : 'utf-8' } ) ;
6775+ if ( installedFormulas . includes ( 'stackql' ) ) {
67776776 core . info ( `stackql is already installed.` ) ;
67786777 const stackqlPath = execSync ( 'which stackql' , { encoding : 'utf-8' } ) . trim ( ) ;
67796778 core . debug ( `Stackql is located at: ${ stackqlPath } ` ) ;
67806779 return path . dirname ( stackqlPath ) ; // Return the directory of the binary
6780+ } else {
6781+ core . info ( `Installing stackql using Homebrew` ) ;
6782+ execSync ( 'brew install stackql' , { stdio : 'inherit' } ) ;
67816783 }
67826784 } catch ( error ) {
6783- core . info ( `stackql is not installed, installing now... ` ) ;
6784- execSync ( 'brew install stackql' , { stdio : 'inherit' } ) ;
6785+ core . info ( `Error checking/ installing stackql: ${ error } ` ) ;
6786+ throw new Error ( `Error checking/installing stackql: ${ error } ` ) ;
67856787 }
67866788 const installedPath = execSync ( 'which stackql' , { encoding : 'utf-8' } ) . trim ( ) ;
67876789 core . debug ( `Stackql installed at: ${ installedPath } ` ) ;
0 commit comments