我如何运行在节点子进程执行中具有自己的选项的命令
我正在创建Make Node Cli自动化我的NPM软件包发布,我对这个问题感到震惊。确认后,我想运行命令语义释放
,但问题它具有自己的提示 我当前使用exec命令,但它没有显示语义释放
代码创建的任何提示。
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);
});
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);
});
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以通过产生同步子过程来显示提示来自父过程的管道。
JS:
test.sh
You can show the prompts by spawning a synchronous child process that inherits it's
stdio
pipes from the parent process.JS :
test.sh
我已经使用这种方式来创建自己的
cli
,这是创建我想要的所有命令并做我想做的所有命令的简单方法图像的很好解释单击此处
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 imagesClick here