From 3465010fc513eb20457e8d4afc5fb5aab68d5bcd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=AC=A7=E5=A6=82=E6=A0=8B?= Date: Fri, 15 Apr 2022 10:34:15 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E9=94=99=E8=AF=AF=E9=80=80?= =?UTF-8?q?=E5=87=BA=E7=A0=81=E4=B8=BA=200=20=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bin/index.js | 11 +++++------ package.json | 2 +- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/bin/index.js b/bin/index.js index 30cd767..0e3d651 100755 --- a/bin/index.js +++ b/bin/index.js @@ -108,7 +108,7 @@ const upload = async (filePath, parts = []) => { logger.error(error.message); logger.error(error.stack); console.log(chalk(error.message)); - return; + process.exit(1); } @@ -169,7 +169,7 @@ const getFileMD5Success = async (filePath) => { logger.error(error.message); logger.error(error.stack); console.log(chalk.red((error.response && error.response.data) || error.message)); - return; + process.exit(1); } } @@ -208,7 +208,7 @@ const getFileMD5 = async (filePath) => { console.log(chalk.red((error.response && error.response.data) || error.message)); logger.error(error.message); logger.error(error.stack); - return; + process.exit(1); } } @@ -217,7 +217,7 @@ const beforeUpload = async (filePath) => { const stat = fs.lstatSync(filePath); if (stat.isDirectory()) { console.log(chalk.red(`\n${filePath}不合法,需指定一个文件\n`)) - return ; + process.exit(1); } fileSize = stat.size; } catch (error) { @@ -228,8 +228,7 @@ const beforeUpload = async (filePath) => { logger.error(error.stack); console.log(chalk.red((error.response && error.response.data) || error.message)); } - process.exitCode = 1; - return; + process.exit(1); } await getFileMD5(filePath); } diff --git a/package.json b/package.json index 427ce6d..caee64a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "coding-generic", - "version": "1.2.5", + "version": "1.2.6", "description": "", "main": "index.js", "bin": {