diff --git a/.github/workflows/blame-ignore.yml b/.github/workflows/blame-ignore.yml index 0d90e527a3..992daad0dd 100644 --- a/.github/workflows/blame-ignore.yml +++ b/.github/workflows/blame-ignore.yml @@ -41,7 +41,7 @@ jobs: - name: Push changes if: ${{ steps.check_changes.outcome == 'failure' }} - uses: ad-m/github-push-action@master + uses: ad-m/github-push-action@d30dc2d070765d7e509df00c34c5fa2dd636ff74 # master as of 2026-05-06 with: branch: ${{ github.ref }} github_token: ${{ secrets.MAA_RESOURCE_SYNC }} diff --git a/.github/workflows/issue-ai-analysis.yml b/.github/workflows/issue-ai-analysis.yml index 4903271c19..6c854c4c0a 100644 --- a/.github/workflows/issue-ai-analysis.yml +++ b/.github/workflows/issue-ai-analysis.yml @@ -33,7 +33,7 @@ jobs: # - https://github.com/MaaAssistantArknights/MaaAssistantArknights/blob/dev-v2/.claude/skills/maa-issue-log-analysis/SKILL.md - name: Analyze issue with AI id: analysis - uses: Misteo/ai-issue-analysis@main + uses: Misteo/ai-issue-analysis@c0b258aa9660a1efd7316c9ed6d9ef81f1ac734a # main as of 2026-05-06 with: github-token: ${{ secrets.MAA_BOT_TOKEN }} copilot-github-token: ${{ secrets.COPILOT_GITHUB_TOKEN }} diff --git a/.github/workflows/optimize-templates.yml b/.github/workflows/optimize-templates.yml index 48638be4a2..dfc52c67b2 100644 --- a/.github/workflows/optimize-templates.yml +++ b/.github/workflows/optimize-templates.yml @@ -104,7 +104,7 @@ jobs: - name: Push changes if: steps.check_push.outputs.is_pr != 'True' && steps.commit_changes.outputs.have_commits == 'True' && github.repository_owner == 'MaaAssistantArknights' - uses: ad-m/github-push-action@master + uses: ad-m/github-push-action@d30dc2d070765d7e509df00c34c5fa2dd636ff74 # master as of 2026-05-06 with: github_token: ${{ secrets.MAA_RESOURCE_SYNC }} branch: ${{ github.ref }} diff --git a/.github/workflows/pre-commit-scheduled.yml b/.github/workflows/pre-commit-scheduled.yml index cc3394aff7..078ab1dc97 100644 --- a/.github/workflows/pre-commit-scheduled.yml +++ b/.github/workflows/pre-commit-scheduled.yml @@ -25,7 +25,7 @@ jobs: - name: Commit and push changes if: steps.pre-commit.outcome == 'failure' && github.repository_owner == 'MaaAssistantArknights' - uses: actions-js/push@master + uses: actions-js/push@5a7cbd780d82c0c937b5977586e641b2fd94acc5 # master as of 2026-05-06 with: github_token: ${{ secrets.GITHUB_TOKEN }} message: "chore: Auto update by pre-commit hooks diff --git a/.github/workflows/res-update-game.yml b/.github/workflows/res-update-game.yml index 437fb21fd2..889bb0dabf 100644 --- a/.github/workflows/res-update-game.yml +++ b/.github/workflows/res-update-game.yml @@ -306,7 +306,7 @@ jobs: - name: Push changes if: steps.add_files.outputs.have_commits == 'True' - uses: ad-m/github-push-action@master + uses: ad-m/github-push-action@d30dc2d070765d7e509df00c34c5fa2dd636ff74 # master as of 2026-05-06 with: branch: ${{ github.ref }} github_token: ${{ secrets.MAA_RESOURCE_SYNC }} diff --git a/.github/workflows/update-submodules.yml b/.github/workflows/update-submodules.yml index 6e3c006092..3c83806d95 100644 --- a/.github/workflows/update-submodules.yml +++ b/.github/workflows/update-submodules.yml @@ -21,7 +21,7 @@ jobs: run: bash ./.github/scripts/sync-optional-submodules.sh --remote src/MAAUnified src/MaaMacGui src/maa-cli - name: Commit and push changes - uses: actions-js/push@master + uses: actions-js/push@5a7cbd780d82c0c937b5977586e641b2fd94acc5 # master as of 2026-05-06 with: github_token: ${{ secrets.GITHUB_TOKEN }} message: "feat: Update Submodules MAAUnified, MaaMacGui, maa-cli diff --git a/src/MaaCore/Controller/Platform/PosixIO.cpp b/src/MaaCore/Controller/Platform/PosixIO.cpp index 09e23785ea..a9264a1498 100644 --- a/src/MaaCore/Controller/Platform/PosixIO.cpp +++ b/src/MaaCore/Controller/Platform/PosixIO.cpp @@ -83,9 +83,12 @@ std::optional asst::PosixIO::call_command( ::close(pipe_out[PIPE_READ]); // TODO: close all other fds - exit_ret = execlp("sh", "sh", "-c", cmd.c_str(), nullptr); + execlp("sh", "sh", "-c", cmd.c_str(), nullptr); Log.error("exec failed:", std::strerror(errno)); - return std::nullopt; + // 必须终止子进程:返回会让 child 在 parent 地址空间的副本里继续 unwind, + // 释放 m_callcmd_mutex、双重析构 fd、kill(0, ...) 误杀整个进程组。 + // 退出码沿用 POSIX shell 约定的 127(command not found)。 + _exit(127); } ::close(pipe_in[PIPE_READ]); ::close(pipe_out[PIPE_WRITE]); diff --git a/src/MaaCore/Utils/DebugImageHelper.hpp b/src/MaaCore/Utils/DebugImageHelper.hpp index ade7c5fb61..14c41040a1 100644 --- a/src/MaaCore/Utils/DebugImageHelper.hpp +++ b/src/MaaCore/Utils/DebugImageHelper.hpp @@ -26,18 +26,47 @@ inline size_t filenum_ctrl(const std::filesystem::path& absolute_or_relative_dir absolute_path = absolute_or_relative_dir; } - if (!std::filesystem::exists(absolute_path)) { + std::error_code dir_ec; + if (!std::filesystem::is_directory(absolute_path, dir_ec)) { + if (dir_ec) { + Log.warn(__FUNCTION__, "failed to inspect debug image directory", absolute_path, dir_ec.message()); + } return 0; } size_t file_nums = 0; std::vector> files; - for (auto& file : std::filesystem::directory_iterator(absolute_path)) { - if (file.is_regular_file()) { - ++file_nums; - files.emplace_back(std::filesystem::last_write_time(file.path()), file.path()); + std::error_code iter_ec; + const auto options = std::filesystem::directory_options::skip_permission_denied; + std::filesystem::directory_iterator iter(absolute_path, options, iter_ec); + if (iter_ec) { + Log.warn(__FUNCTION__, "failed to open debug image directory", absolute_path, iter_ec.message()); + return 0; + } + for (const std::filesystem::directory_iterator end; iter != end; iter.increment(iter_ec)) { + if (iter_ec) { + Log.warn(__FUNCTION__, "failed to iterate debug image directory", absolute_path, iter_ec.message()); + break; } + + const auto& file = *iter; + std::error_code entry_ec; + if (!file.is_regular_file(entry_ec)) { + if (entry_ec) { + Log.warn(__FUNCTION__, "failed to inspect debug image entry", file.path(), entry_ec.message()); + } + continue; + } + + const auto write_time = std::filesystem::last_write_time(file.path(), entry_ec); + if (entry_ec) { + Log.warn(__FUNCTION__, "failed to query debug image timestamp", file.path(), entry_ec.message()); + continue; + } + + ++file_nums; + files.emplace_back(write_time, file.path()); } std::sort(files.begin(), files.end(), [](auto& a, auto& b) { @@ -62,7 +91,7 @@ inline size_t filenum_ctrl(const std::filesystem::path& absolute_or_relative_dir ++deleted; } else if (ec) { - LogWarn << "Skip deleting debug image in this round" << files[i].second << ec.value() << ec.message(); + Log.warn(__FUNCTION__, "failed to remove old debug image", files[i].second, ec.message()); } }