Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

307
Views
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 answers
Answer question

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 Report

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!