File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -75,19 +75,27 @@ app.on('ready', () => {
7575 */
7676} ) ;
7777
78+ const { exec } = require ( 'child_process' ) ;
79+
7880ipcMain . handle ( 'install-git' , async ( event , args ) => {
7981 return new Promise ( ( resolve , reject ) => {
80- exec ( 'winget install Git.Git' , ( error , stdout , stderr ) => {
82+ const gitInstallationProcess = exec ( 'winget install Git.Git' , ( error , stdout , stderr ) => {
8183 if ( error ) {
8284 console . error ( `Error executing git: ${ error . message } ` ) ;
8385 reject ( error . message ) ;
8486 return ;
8587 }
8688
8789 if ( stderr ) {
88- console . error ( 'Error during git command:' , stderr ) ;
89- reject ( stderr ) ;
90- return ;
90+ // Check if stderr contains the agreement message
91+ if ( stderr . includes ( "You must agree to the license terms before installing" ) ) {
92+ // If agreement message is found, simulate pressing 'Enter'
93+ gitInstallationProcess . stdin . write ( '\r\n' ) ;
94+ } else {
95+ console . error ( 'Error during git command:' , stderr ) ;
96+ reject ( stderr ) ;
97+ return ;
98+ }
9199 } else {
92100 console . log ( 'Git installed:' , stdout . trim ( ) ) ;
93101 resolve ( stdout . trim ( ) ) ;
You can’t perform that action at this time.
0 commit comments