Skip to content

Commit f14391a

Browse files
authored
sync: 工具链 pin 跟进 — mcpp → 2026.8.1.1,d2x → 2026.08.02.1 (#87)
* sync: 工具链 pin 跟进 —— mcpp 0.0.104 → 2026.8.1.1,d2x → 2026.08.02.1 mcpp 侧不是升级偏好,是必须:mcpplibs 依赖索引已把 index floor 抬到 0.0.109, 钉在 0.0.104 的工程一律 E0006「index requires mcpp >= 0.0.109」而拒绝解析依赖。 d2x 仓库的 CI 因此一度全平台红,并为本课程加了一步「安装前把 pin 对齐」的 workaround —— 本次同步之后那步就可以撤掉了。 d2x 侧跟到刚发布的 2026.08.02.1:Win10 / Win11 CI(完整测试段 + 以本课程做 checker 真实冒烟)、Windows 上练习页路径显示修复、Windows 活性超时补齐。 CI 头部注释一并更新:原文只写了「依赖 mcpp >= 0.0.104」,而真实下限已被上游 抬到 0.0.109,不写清楚下一个人会以为 0.0.104 还能用。 * fix(provider): Windows 上 capture_stdout 的 2>/dev/null 让 mcpp test 根本没跑 Windows 上每道练习都判不出结果,现象是 Provider 报「mcpp test 没有返回 '<test>' 的记录」,看起来像 mcpp 不支持 --message-format json —— 实际是本仓库 Provider 自己的问题。 capture_stdout 无条件给命令尾巴上接 ` 2>/dev/null`。Windows 上 _popen 走的是 cmd.exe,那里没有 /dev/null:cmd 把它当成「重定向到 \dev\null 这个路径」,而 \dev 不存在,于是直接报 The system cannot find the path specified. 并且整条命令根本不执行。mcpp test 一条 JSON 都没吐,解析侧 saw_any 为假,判定 链退化成「没有该测试的记录」,那句「mcpp 可能不支持 --message-format json」的 提示把锅指错了方向。 证据(d2x 的 Win10 / Win11 checker 冒烟实测): 外层 `mcpp run -q -p d2x/buildtools -- check hello-mcpp` 本身跑得通 —— 说明 mcpp 在 PATH 上(不在的话 cmd 会报 'mcpp' is not recognized,是另一句话); 只有内层带 2>/dev/null 的 mcpp test 挂掉。两者唯一的差别就是这个重定向。 空设备在 cmd 下叫 NUL,按平台分开写即可。POSIX 分支拼出的字符串与改前逐字节 相同,linux 行为不变;本地实测 check hello-mcpp 仍是 stage → output(真实编译 错误)→ verdict fail。
1 parent d0a7fbe commit f14391a

3 files changed

Lines changed: 19 additions & 5 deletions

File tree

.github/workflows/dslings-ref-ci.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,11 @@ name: Validate exercises and reference solutions
88
# 链路,所以 CI 绿灯等价于学习者本地能跑通,而不是另一条平行的构建路径。
99
#
1010
# 依赖 mcpp >= 0.0.104(测试能力批次:逐测试隔离 / 过滤 / --list / --timeout /
11-
# --message-format json / tests 吃 [build].flags)。pin 见 .xlings.json。
11+
# --message-format json / tests 吃 [build].flags)。
12+
#
13+
# 但真正的下限已被上游抬高:mcpplibs 依赖索引现在要求 mcpp >= 0.0.109,更低的
14+
# 版本一律 E0006「index requires mcpp >= 0.0.109」而拒绝解析依赖 —— 原先钉的
15+
# 0.0.104 自此装不出来。pin 见 .xlings.json,当前为 2026.8.1.1。
1216

1317
on:
1418
push:

.xlings.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
{
22
"workspace": {
3-
"d2x": "2026.07.24.1",
3+
"d2x": "2026.08.02.1",
44
"mdbook": "0.4.43",
55
"code": "",
66
"mcpp": {
7-
"linux": "0.0.104",
8-
"macosx": "0.0.104",
9-
"windows": "0.0.104"
7+
"linux": "2026.8.1.1",
8+
"macosx": "2026.8.1.1",
9+
"windows": "2026.8.1.1"
1010
}
1111
}
1212
}

d2x/buildtools/src/runner.cppm

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,17 @@ export struct Captured {
3333
// workaround 随之删除。
3434
export Captured capture_stdout(const std::string& cmd) {
3535
Captured result;
36+
// 丢弃 stderr 的写法必须分平台:_popen 走的是 cmd.exe,那里没有
37+
// /dev/null —— `2>/dev/null` 会被当成「重定向到 \dev\null 这个路径」,
38+
// 而 \dev 不存在,cmd 直接报 "The system cannot find the path specified."
39+
// 并且整条命令根本不执行。于是 mcpp test 一条 JSON 都吐不出来,判定链
40+
// 退化成「没有该测试的记录」,Windows 上每道题都卡在这里(d2x 的
41+
// Win10/Win11 checker 冒烟实测)。空设备在 cmd 下叫 NUL。
42+
#ifdef _WIN32
43+
std::string full = cmd + " 2>NUL";
44+
#else
3645
std::string full = cmd + " 2>/dev/null";
46+
#endif
3747

3848
#ifdef _WIN32
3949
FILE* pipe = ::_popen(full.c_str(), "r");

0 commit comments

Comments
 (0)