From 7e1ea611a2bec1c1498b762473c894af91938a6c Mon Sep 17 00:00:00 2001 From: doubleam Date: Fri, 12 Apr 2024 22:25:33 +0800 Subject: [PATCH] Feat: add runSync log --- bin/xcmd.js | 11 +++++------ package.json | 2 +- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/bin/xcmd.js b/bin/xcmd.js index f93cc28..8eab0c6 100644 --- a/bin/xcmd.js +++ b/bin/xcmd.js @@ -393,12 +393,11 @@ program .action(() => { let cmdStr = 'npm i nrm pnpm cnpm js-xcmd nodemon pm2 yarn rimraf protobufjs protobufjs-cli -g'; console.log({ cmdStr }); - nodeCmd.run(cmdStr, (err, data, stderr) => { - console.log(stderr); - if (err) return console.log(`%c出错啦!${data}`, 'color:red;'); - console.log(data); - console.log('----------Successful----------'); - }); + const result = nodeCmd.runSync(cmdStr); + console.log(result.stderr); + if (result.err) return console.log(`%c出错啦!${result.data}`, 'color:red;'); + console.log(result.data); + console.log('----------Successful----------'); }); program diff --git a/package.json b/package.json index 52b5fcc..888ee8e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "js-xcmd", - "version": "1.4.10", + "version": "1.4.11", "description": "XCmd library for node.js.", "main": "main.js", "bin": {