Skip to content

Сохранение батника в UTF8NoBOM#267

Merged
nixel2007 merged 3 commits intooscript-library:masterfrom
Segate-ekb:master
May 6, 2026
Merged

Сохранение батника в UTF8NoBOM#267
nixel2007 merged 3 commits intooscript-library:masterfrom
Segate-ekb:master

Conversation

@Segate-ekb
Copy link
Copy Markdown
Contributor

@Segate-ekb Segate-ekb commented May 5, 2026

Перед чтением - переключаем кодировку, после - возвращаем ту что была до запуска батника.

closes #265

Summary by CodeRabbit

  • Исправления ошибок

    • Исправлена поддержка кириллицы в путях проектов на Windows при создании скриптов запуска.
  • Тесты

    • Добавлены тесты для проверки корректной кодировки файлов на Windows-платформе.
  • Чистка кода

    • Версия продукта обновлена с 1.6.5 на 1.6.6.

Segate-ekb added 2 commits May 6, 2026 00:58
Перед чтением - переключаем кодировку, после - возвращаем ту что была до запуска батника.
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 5, 2026

Warning

Rate limit exceeded

@Segate-ekb has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 45 minutes and 48 seconds before requesting another review.

To keep reviews running without waiting, you can enable usage-based add-on for your organization. This allows additional reviews beyond the hourly cap. Account admins can enable it under billing.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 6113222d-c490-4799-8fcf-97d7a27d7580

📥 Commits

Reviewing files that changed from the base of the PR and between 040e478 and a8407eb.

📒 Files selected for processing (1)
  • src/core/Классы/УстановкаПакета.os

Walkthrough

Исправление критической ошибки генерации .bat файлов на Windows для проектов с кириллицей в пути: изменена кодировка с cp866 на UTF-8 с переключением кодовой страницы; версия продукта обновлена до 1.6.6; добавлен тест для проверки кодировки при локальной установке.

Changes

Исправление генерации BAT-файлов с поддержкой Кириллицы

Layer / File(s) Summary
Версия продукта
packagedef
Версия по умолчанию обновлена с 1.6.5 на 1.6.6 в ветке Else (при отсутствии локального файла констант).
Реализация
src/core/Классы/УстановкаПакета.os
Функция СоздатьСкриптЗапуска переработана для Windows: BAT-файлы теперь создаются в кодировке UTF-8 с сохранением исходной кодовой страницы в переменную _opm_cp, временным переключением на UTF-8 (chcp 65001) и восстановлением исходной кодовой страницы после запуска oscript.
Тестирование
tests/bat-launcher-test.os
Добавлен новый Windows-специфичный тестовый набор для воспроизведения issue #265, проверяющий корректное создание BAT-файлов с кириллицей в пути проекта при локальной установке пакета.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

  • oscript-library/opm#251: Оба PR изменяют значение версии продукта по умолчанию в packagedef/Константы для случая отсутствия локального файла констант.
  • oscript-library/opm#258: Оба PR выполняют обновление версии продукта в packagedef при отсутствии локальных констант.

Suggested reviewers

  • nixel2007
  • EvilBeaver

Poem

🐰 Батники на Windows теперь поют в кодировке UTF-8,
Кириллица в пути больше не враг, а верный союзник,
Страница сохранена, в 65001 переключена, восстановлена с честью,
Тест стоит на страже, проверяя кодировку в деле,
Версия 1.6.6 спешит к свету! 🌟

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed Название четко описывает основное изменение — сохранение BAT-файла в кодировке UTF8NoBOM, что соответствует основной цели PR по исправлению проблемы с кириллицей в путях.
Linked Issues check ✅ Passed PR успешно решает требование issue #265: изменена кодировка сгенерированных BAT-файлов на UTF8 с переключением системной кодовой страницы перед выполнением и восстановлением после, включен тест для проверки.
Out of Scope Changes check ✅ Passed Все изменения находятся в области действия issue #265: обновление версии продукта, модификация функции создания BAT-файла и добавление теста для кириллицы в пути.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Tip

💬 Introducing Slack Agent: The best way for teams to turn conversations into code.

Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.

  • Generate code and open pull requests
  • Plan features and break down work
  • Investigate incidents and troubleshoot customer tickets together
  • Automate recurring tasks and respond to alerts with triggers
  • Summarize progress and report instantly

Built for teams:

  • Shared memory across your entire org—no repeating context
  • Per-thread sandboxes to safely plan and execute work
  • Governance built-in—scoped access, auditability, and budget controls

One agent for your entire SDLC. Right inside Slack.

👉 Get started


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
tests/bat-launcher-test.os (1)

21-21: ⚡ Quick win

Приведите имя теста к фактической проверке

Имя говорит «не содержит», но утверждение проверяет, что путь содержится. Лучше переименовать кейс так, чтобы он явно описывал проверку UTF-8/наличия кириллицы.

Also applies to: 36-37, 54-55

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@tests/bat-launcher-test.os` at line 21, The test name
ИменаТестов.Добавить("ТестДолжен_НеСодержатьАбсолютныйКириллицкийПутьВBatФайлеПриЛокальнойУстановке")
contradicts the assertion (it actually checks that a Cyrillic/UTF-8 absolute
path is present); rename this test to something like
"ТестДолжен_СодержатьАбсолютныйКириллицкийПутьВBatФайлеПриЛокальнойУстановке"
(and likewise update the other two test names at the similar occurrences) so the
name explicitly states it verifies presence of a UTF-8/Cyrillic absolute path
and matches the assertion behavior.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/core/Классы/УстановкаПакета.os`:
- Around line 301-304: После вызова oscript (строка с
ФайлЗапуска.ЗаписатьСтроку("@call oscript ...")) сохраните текущий %ERRORLEVEL%
в временную переменную сразу же перед восстановлением code page, затем
выполняйте восстановление кодировки (ФайлЗапуска.ЗаписатьСтроку("@chcp %_opm_cp%
> nul")) и завершайте батник командой exit /b с использованием сохранённой
переменной вместо непосредственного %ERRORLEVEL%; другими словами, захватите код
возврата после вызова oscript и используйте эту сохранённую переменную при
ФайлЗапуска.ЗаписатьСтроку("@exit /b ...") чтобы вернуть корректный код
завершения.

---

Nitpick comments:
In `@tests/bat-launcher-test.os`:
- Line 21: The test name
ИменаТестов.Добавить("ТестДолжен_НеСодержатьАбсолютныйКириллицкийПутьВBatФайлеПриЛокальнойУстановке")
contradicts the assertion (it actually checks that a Cyrillic/UTF-8 absolute
path is present); rename this test to something like
"ТестДолжен_СодержатьАбсолютныйКириллицкийПутьВBatФайлеПриЛокальнойУстановке"
(and likewise update the other two test names at the similar occurrences) so the
name explicitly states it verifies presence of a UTF-8/Cyrillic absolute path
and matches the assertion behavior.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: c5221268-eb7e-4ba1-b96f-e2061dc3cc74

📥 Commits

Reviewing files that changed from the base of the PR and between 6962d55 and 040e478.

📒 Files selected for processing (3)
  • packagedef
  • src/core/Классы/УстановкаПакета.os
  • tests/bat-launcher-test.os

Comment thread src/core/Классы/УстановкаПакета.os Outdated
@johnnyshut
Copy link
Copy Markdown

Выглядит интереснее чем мое решение

@nixel2007 nixel2007 merged commit cf99ca7 into oscript-library:master May 6, 2026
9 of 10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] Генерирует нерабочие .bat при кириллице в пути проекта (Windows)

3 participants