Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

309
Vistas
How can I run command which has it own options in node child process exec

I am creating make node CLI automate my npm package publishing, I am struck by this problem. After all Confirmation, I want to run the command semantic-release but problem it has its own prompts I currently use exec command but It does not show any prompts created by semantic-release

Code

const timer = showLoading(`running ${chalk.blue(command)} `);
exec(command, (error, stdout, stderr) => {
                process.stdout.write(chalk.dim(`\r running ${chalk.blue(command)}   `));
                clearInterval(timer);
                defaults.onFinish();
                if (error) {
                    defaults.onError(error);
                    console.log(error);
                }
                defaults.onSuccess(stdout);
                console.log(stdout);
            });
about 4 years ago · Juan Pablo Isaza
2 Respuestas
Responde la pregunta

0

You can show the prompts by spawning a synchronous child process that inherits it's stdio pipes from the parent process.

JS :

import { spawnSync } from 'child_process';
let { status } = spawnSync('./test.sh', [], { stdio: 'inherit' });
if (status > 0) { throw new Error('spawned process exited abnormally'); }

test.sh

#!/bin/bash
read -p 'enter something: ' value
[ -z "$value" ] && exit 1
echo "$value"
about 4 years ago · Juan Pablo Isaza Denunciar

0

I have used this way to create my own CLI, it's an easy way to create all the commands that I want and to do what I want, check the link maybe that helps you, in the website there also good explanation with images

Click here

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda