Install Homebrew as a dependency in Electron through Child_Process

Viewed 291

I want to install homebrew dependency for MACOS using Electron JS. I am unable to do so because the command which is used to install homebrew requires multiple interrupts from the user.

I have tried using child_process of node js but I am unable to provide sudo password to that command. How can I do so

Homebrew Installation Command:

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

My Code:

const command = require('child_process').exec;
const ps = command('yes | /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"');



ps.stdout.on('data', (data) => {
  console.log(data);
  ps.stdin.write("password");
});

ps.stderr.on('data', (data) => {
  console.log(`ps stderr: ${data}`);
});

ps.on('close', (code) => {
  if (code !== 0) {
    console.log(`ps process exited with code ${code}`);
  }
});

Please help me out in installing the homebrew dependency for macos using electron js. I am stuck in it.

0 Answers
Related