fix(judge): treat empty output files as existing#1186
Conversation
|
All contributors have signed the CLA ✍️ ✅ |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
Walkthrough
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~2 minutes 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 ESLint
packages/hydrojudge/src/sandbox.tsESLint skipped: missing config or dependency (missing-dependency). The ESLint configuration references a package that is not available in the sandbox. 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. Comment |
|
I have read the CLA Document and I hereby sign the CLA |
|
Please provide a non-working example (problem package & code / hydro.ac submission link) |
https://hydro.ac/p/loj-P3891 这是一道需要文件freopen的题目,对于自测样例的空输出,它打印的是RE:
期望行为应该是空输出,而不是文件不存在。 https://hydro.ac/p/luogu-B4177 对于一个标准输入输出的题目,期望的自测样例的空输出应该是:
|


fix(judge): treat empty output files as existing
When using file IO mode, HydroJudge checked output file existence with a truthy value check on
ret.files[outname].This caused a valid zero-byte output file, such as an empty
user.out, to be treated as missing because an empty string is falsy in JavaScript. As a result, pretests with empty output incorrectly failed withOutput file not found.Check whether the output file key exists instead of checking whether its content is truthy, and preserve empty stdout/stderr with nullish coalescing.
Summary by CodeRabbit
stdoutandstderrcontent instead of treating it as missing.