Commit 566b295
committed
Record the command's id in CFSetExitCode for built-in handlers
handleCommand receives the whole T_SimpleCommand as `cmd`, and the ordinary
path registers the exit code against it through
`handleOthers (getId cmd) ...`. regularExpansionWithStatus, used by the
built-in table, shadowed that name with the command's first word, so printf,
unset, wait, mapfile, readarray, read and the four DEFINE_* commands recorded
their exit code under the id of a T_NormalWord instead.
Consumers that resolve the id through idMap then get a word where they expect
a command. checkOverwrittenExitCode is one of them: getCommandBasename is
Nothing for a T_NormalWord, so isPrinting never matched and SC2320 stayed
silent for printf while firing for echo, which is not in the table and goes
through handleOthers.
Drop the shadowing pattern so cmd again refers to the command.
Fixes #34901 parent 9af7ee2 commit 566b295
2 files changed
Lines changed: 3 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5097 | 5097 | | |
5098 | 5098 | | |
5099 | 5099 | | |
| 5100 | + | |
| 5101 | + | |
5100 | 5102 | | |
5101 | 5103 | | |
5102 | 5104 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1196 | 1196 | | |
1197 | 1197 | | |
1198 | 1198 | | |
1199 | | - | |
| 1199 | + | |
1200 | 1200 | | |
1201 | 1201 | | |
1202 | 1202 | | |
| |||
0 commit comments