mirror of
https://github.com/whyour/qinglong.git
synced 2026-07-01 04:40:38 +08:00
修复任务执行前命令错误提示
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
const { execSync } = require('child_process');
|
||||
require(`./env.js`);
|
||||
|
||||
function expandRange(rangeStr, max) {
|
||||
const tempRangeStr = rangeStr
|
||||
.trim()
|
||||
@@ -30,8 +31,6 @@ function run() {
|
||||
task_before,
|
||||
} = process.env;
|
||||
|
||||
require(file_task_before_js);
|
||||
|
||||
try {
|
||||
const splitStr = '__sitecustomize__';
|
||||
const fileName = process.argv[1].replace(`${dir_scripts}/`, '');
|
||||
@@ -60,10 +59,19 @@ function run() {
|
||||
}
|
||||
} catch (error) {
|
||||
if (!error.message.includes('spawnSync /bin/sh E2BIG')) {
|
||||
console.log(`run task before error: `, error);
|
||||
console.log(`❌ run task before error: `, error);
|
||||
} else {
|
||||
console.log(
|
||||
`❌ The environment variable is too large. It is recommended to use task_before.js instead of task_before.sh\n`,
|
||||
);
|
||||
}
|
||||
if (task_before) {
|
||||
console.log('执行前置命令结束\n');
|
||||
}
|
||||
}
|
||||
|
||||
require(file_task_before_js);
|
||||
|
||||
if (envParam && numParam) {
|
||||
const array = (process.env[envParam] || '').split('&');
|
||||
const runArr = expandRange(numParam, array.length);
|
||||
|
||||
Reference in New Issue
Block a user