0

I'm putting together a script to create certificates for my devices, I thought I'd use shelljs to run these commands. I created a basic command for certificate generation, but the script stops running when cmd has a question, as in the example:

const shell = require('shelljs')
shell.exec("openssl genrsa -out deviceCert.key 2048")
shell.exec("openssl req -new -key deviceCert.key -out deviceCert.csr")

enter image description here

I would like to know if there is any command that I can use to answer these cmd questions by shelljs itself.

Vinicius
  • 15
  • 4

1 Answers1

0

Try something like this:

shell.exec("echo -ne 'AU' | openssl req -new -key deviceCert.key -out deviceCert.csr")
kawadhiya21
  • 2,458
  • 21
  • 34