Commit 0e9c699
authored
fix: force NO_COLOR on cargo subprocesses so the parser stops missing colorized version: lines (#22)
* fix: force NO_COLOR on cargo subprocesses so the parser stops missing colorized `version:` lines
When a workflow sets `CARGO_TERM_COLOR=always` (or the user's env enables
it), cargo wraps field labels in ANSI SGR escapes:
\e[1m\e[92mversion:\e[0m 0.6.0
The cargo info parser at lib.js:155 was anchored — `^version:` — so the
escape-prefixed line didn't match, `parseCargoInfoVersion` returned null,
`getPublishedVersion` rejected, and `filterPublishable` warned and skipped
the candidate. Net effect: `roas` (and any other crate run under a
color-on workflow) silently dropped out of the publish output even though
it's published on crates.io.
Fix in two layers:
- Spawn `cargo metadata` and `cargo info` with `CARGO_TERM_COLOR=never`
and `NO_COLOR=1` layered over `process.env` via a `plainEnv()` helper.
Cargo never produces ANSI escapes for the output we parse, regardless
of the calling workflow's preferences.
- Strip ANSI SGR escapes in `parseCargoInfoVersion` before the regex
match — defense-in-depth so the parser stays correct even if a future
caller bypasses `plainEnv()`.
Tests: new regression case feeds the parser the exact colorized
`version:` line cargo emits under `CARGO_TERM_COLOR=always`. 33/33 pass;
dist rebuilt.
Assisted-By: Claude <noreply@anthropic.com>
Signed-off-by: Sergey Vilgelm <sergey@vilgelm.com>
* chore: bump to 1.1.1
Patch bump for the cargo-info color-env fix in this branch.
Assisted-By: Claude <noreply@anthropic.com>
Signed-off-by: Sergey Vilgelm <sergey@vilgelm.com>
---------
Signed-off-by: Sergey Vilgelm <sergey@vilgelm.com>1 parent 7c4e86d commit 0e9c699
5 files changed
Lines changed: 47 additions & 11 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
28024 | 28024 | | |
28025 | 28025 | | |
28026 | 28026 | | |
28027 | | - | |
| 28027 | + | |
28028 | 28028 | | |
28029 | 28029 | | |
28030 | 28030 | | |
| |||
28062 | 28062 | | |
28063 | 28063 | | |
28064 | 28064 | | |
| 28065 | + | |
| 28066 | + | |
| 28067 | + | |
| 28068 | + | |
| 28069 | + | |
| 28070 | + | |
| 28071 | + | |
| 28072 | + | |
| 28073 | + | |
28065 | 28074 | | |
28066 | 28075 | | |
28067 | 28076 | | |
| |||
28132 | 28141 | | |
28133 | 28142 | | |
28134 | 28143 | | |
28135 | | - | |
| 28144 | + | |
| 28145 | + | |
| 28146 | + | |
| 28147 | + | |
28136 | 28148 | | |
28137 | | - | |
| 28149 | + | |
| 28150 | + | |
28138 | 28151 | | |
28139 | 28152 | | |
28140 | 28153 | | |
| |||
28156 | 28169 | | |
28157 | 28170 | | |
28158 | 28171 | | |
28159 | | - | |
| 28172 | + | |
28160 | 28173 | | |
28161 | 28174 | | |
28162 | 28175 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
42 | 42 | | |
43 | 43 | | |
44 | 44 | | |
45 | | - | |
| 45 | + | |
46 | 46 | | |
47 | 47 | | |
48 | 48 | | |
| |||
80 | 80 | | |
81 | 81 | | |
82 | 82 | | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
83 | 92 | | |
84 | 93 | | |
85 | 94 | | |
| |||
150 | 159 | | |
151 | 160 | | |
152 | 161 | | |
153 | | - | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
154 | 166 | | |
155 | | - | |
| 167 | + | |
| 168 | + | |
156 | 169 | | |
157 | 170 | | |
158 | 171 | | |
| |||
174 | 187 | | |
175 | 188 | | |
176 | 189 | | |
177 | | - | |
| 190 | + | |
178 | 191 | | |
179 | 192 | | |
180 | 193 | | |
| |||
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
271 | 271 | | |
272 | 272 | | |
273 | 273 | | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
274 | 284 | | |
275 | 285 | | |
276 | 286 | | |
| |||
0 commit comments