系统日志增加时间筛选和清空

This commit is contained in:
whyour
2024-08-22 00:47:24 +08:00
parent f6021c8157
commit f4cb3eacf8
10 changed files with 209 additions and 78 deletions
+4 -2
View File
@@ -41,8 +41,8 @@ function run() {
.replace(/"/g, '\\"')
.replace(/\$/g, '\\$');
command = `${command} && eval '${escapeTaskBefore}'`;
console.log('执行前置命令\n');
}
console.log('执行前置命令\n');
const res = execSync(
`${command} && echo -e '${splitStr}' && NODE_OPTIONS= node -p 'JSON.stringify(process.env)'"`,
{
@@ -55,7 +55,9 @@ function run() {
process.env[key] = newEnvObject[key];
}
console.log(output);
console.log('执行前置命令结束\n');
if (task_before) {
console.log('执行前置命令结束\n');
}
} catch (error) {
if (!error.message.includes('spawnSync /bin/sh E2BIG')) {
console.log(`run task before error: `, error);
+3 -2
View File
@@ -46,11 +46,11 @@ def run():
if task_before:
escape_task_before = task_before.replace('"', '\\"').replace("$", "\\$")
command += f" && eval '{escape_task_before}'"
print("执行前置命令\n")
python_command = "PYTHONPATH= python3 -c 'import os, json; print(json.dumps(dict(os.environ)))'"
command += f" && echo -e '{split_str}' && {python_command}\""
print("执行前置命令\n")
res = subprocess.check_output(command, shell=True, encoding="utf-8")
output, env_str = res.split(split_str)
@@ -60,7 +60,8 @@ def run():
os.environ[key] = value
print(output)
print("执行前置命令结束")
if task_before:
print("执行前置命令结束")
except subprocess.CalledProcessError as error:
print(f"run task before error: {error}")