Compare commits

...

3 Commits

Author SHA1 Message Date
remittor
80d5e49bcc luci: Fix func execAndRead 2026-01-31 23:08:13 +03:00
remittor
4cccfa7917 executor: Fix error "XHR request timed out" 2026-01-31 21:26:58 +03:00
remittor
2e4b55def5 build: Delete arch riscv64_riscv64 2026-01-31 17:05:23 +03:00
3 changed files with 28 additions and 18 deletions

View File

@@ -155,7 +155,6 @@ jobs:
- mipsel_24kc_24kf
- mipsel_74kc
- mipsel_mips32
- riscv64_riscv64
- riscv64_generic
- x86_64
isTestOrFake:
@@ -165,8 +164,6 @@ jobs:
arch: arm_cortex-a9_vfpv3-d16
- branch: ${{ needs.var.outputs.APK_BRANCH }}
arch: mips_4kec
- branch: ${{ needs.var.outputs.APK_BRANCH }}
arch: riscv64_riscv64
- branch: ${{ needs.var.outputs.IPK_BRANCH }}
arch: riscv64_generic
- { isTestOrFake: true }

View File

@@ -809,11 +809,23 @@ return baseclass.extend({
{
ticks += 1;
try {
if (retCode < 0) {
let rc = await fs.exec('/bin/cat', [ rcFile ], null);
if (rc.code != 0) {
fixLogEnd();
resolve(callback.call(ctx, 542, 'ERROR: cannot read file "' + rcFile + '"'));
return;
}
if (rc.stdout) {
retCode = parseInt(rc.stdout.trim(), 10);
}
}
let res = await fs.exec('/bin/cat', [ logFile ], null);
if (res.code != 0) {
if (ticks > 1) {
console.log('ERROR: execAndRead: '+JSON.stringify(opt_list));
resolve(callback.call(ctx, 541, 'ERROR: Failed on read process log: code = ' + res.code));
fixLogEnd();
resolve(callback.call(ctx, 546, 'ERROR: Failed on read process log: code = ' + res.code));
return;
}
setTimeout(epoll, 500);
@@ -831,17 +843,6 @@ return baseclass.extend({
appendLog(log, '');
lastLen = res.stdout.length;
}
if (retCode < 0) {
let rc = await fs.exec('/bin/cat', [ rcFile ], null);
if (rc.code != 0) {
fixLogEnd();
resolve(callback.call(ctx, 545, 'ERROR: cannot read file "' + rcFile + '"'));
return;
}
if (rc.stdout) {
retCode = parseInt(rc.stdout.trim(), 10);
}
}
if (retCode >= 0) {
fixLogEnd();
if (retCode == 0 && res.stdout) {

View File

@@ -1,12 +1,18 @@
#!/bin/sh
# Copyright (c) 2024 remittor
PID_FILE=/tmp/zapret-script-exec.pid
[ -f $PID_FILE ] && exit 70
if [ -f $PID_FILE ]; then
echo "ERROR: file $PID_FILE already exists!" | awk 'NR==1'
exit 70
fi
LOG_FILE=$1
RC_FILE=$1.rc
SH_FILE=$2
shift 2
[ ! -f $SH_FILE ] && exit 71
if [ ! -f $SH_FILE ]; then
echo "ERROR: script $SH_FILE not found!" | awk 'NR==1'
exit 71
fi
: > $LOG_FILE
: > $RC_FILE
start-stop-daemon -S -b -p $PID_FILE -x /bin/sh -- -c '
@@ -16,7 +22,13 @@ start-stop-daemon -S -b -p $PID_FILE -x /bin/sh -- -c '
shift 3
sh $SH_FILE "$@" > $LOG_FILE 2>&1
RET_CODE=$?
sleep 1
wc -l $LOG_FILE >/dev/null
echo $RET_CODE > $RC_FILE
' sh $LOG_FILE $RC_FILE $SH_FILE "$@"
RET_CODE=$?
if [ $RET_CODE != 0 ]; then
echo "ERROR: script $SH_FILE not executed! ret_code = $RET_CODE" | awk 'NR==1'
exit $RET_CODE
fi
echo "Script $SH_FILE running..." | awk 'NR==1'
exit 0