Skip to content

Commit d34583c

Browse files
authored
Merge pull request #13 from randyou/master
修复错误退出码为 0 的问题
2 parents 9cadb2d + 3465010 commit d34583c

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

bin/index.js

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ const upload = async (filePath, parts = []) => {
108108
logger.error(error.message);
109109
logger.error(error.stack);
110110
console.log(chalk(error.message));
111-
return;
111+
process.exit(1);
112112
}
113113

114114

@@ -169,7 +169,7 @@ const getFileMD5Success = async (filePath) => {
169169
logger.error(error.message);
170170
logger.error(error.stack);
171171
console.log(chalk.red((error.response && error.response.data) || error.message));
172-
return;
172+
process.exit(1);
173173
}
174174
}
175175

@@ -208,7 +208,7 @@ const getFileMD5 = async (filePath) => {
208208
console.log(chalk.red((error.response && error.response.data) || error.message));
209209
logger.error(error.message);
210210
logger.error(error.stack);
211-
return;
211+
process.exit(1);
212212
}
213213
}
214214

@@ -217,7 +217,7 @@ const beforeUpload = async (filePath) => {
217217
const stat = fs.lstatSync(filePath);
218218
if (stat.isDirectory()) {
219219
console.log(chalk.red(`\n${filePath}不合法,需指定一个文件\n`))
220-
return ;
220+
process.exit(1);
221221
}
222222
fileSize = stat.size;
223223
} catch (error) {
@@ -228,8 +228,7 @@ const beforeUpload = async (filePath) => {
228228
logger.error(error.stack);
229229
console.log(chalk.red((error.response && error.response.data) || error.message));
230230
}
231-
process.exitCode = 1;
232-
return;
231+
process.exit(1);
233232
}
234233
await getFileMD5(filePath);
235234
}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "coding-generic",
3-
"version": "1.2.5",
3+
"version": "1.2.6",
44
"description": "",
55
"main": "index.js",
66
"bin": {

0 commit comments

Comments
 (0)