Skip to content

Commit

Permalink
修复执行 task_before 环境变量加载顺序
Browse files Browse the repository at this point in the history
  • Loading branch information
whyour committed Jul 28, 2024
1 parent be2da98 commit fe4516d
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 21 deletions.
14 changes: 5 additions & 9 deletions shell/preload/sitecustomize.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,5 @@
const { execSync } = require('child_process');
const { sendNotify } = require('./notify.js');
require(`./env.js`);

function initGlobal() {
global.QLAPI = {
notify: sendNotify,
};
}

function expandRange(rangeStr, max) {
const tempRangeStr = rangeStr
.trim()
Expand Down Expand Up @@ -76,8 +68,12 @@ function run() {
}

try {
initGlobal();
run();

const { sendNotify } = require('./notify.js');
global.QLAPI = {
notify: sendNotify,
};
} catch (error) {
console.log(`run builtin code error: `, error, '\n');
}
21 changes: 9 additions & 12 deletions shell/preload/sitecustomize.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,6 @@
import builtins
import sys
import env
from notify import send


class BaseApi:
def notify(self, *args, **kwargs):
return send(*args, **kwargs)


def init_global():
QLAPI = BaseApi()
builtins.QLAPI = QLAPI


def try_parse_int(value):
Expand Down Expand Up @@ -92,7 +81,15 @@ def run():


try:
init_global()
run()

from notify import send

class BaseApi:
def notify(self, *args, **kwargs):
return send(*args, **kwargs)

QLAPI = BaseApi()
builtins.QLAPI = QLAPI
except Exception as error:
print(f"run builtin code error: {error}\n")

0 comments on commit fe4516d

Please sign in to comment.