https://bugs.winehq.org/show_bug.cgi?id=57615
--- Comment #1 from Eric Pouech eric.pouech@gmail.com --- what happens is that the 'chcp 65001' command returns a non-zero value when run through winetricks-test (and doesn't when run directly)
this very likely is a sign that the cmd.exe instance (from which the 'chcp 65001' command is run) isn't attached to any console
this happens when a wine process is started from command line and none of the stdin/stdout/stderr being bound to a unix console
(and the unix console being the shell from which winetricks-test is run from)
the mentionned patch does the "right" think (compared to windows behavior) and AFAICT native chcp also fails when not bound to a console. It likely handles a bit differently success/failure of RHS in && operator.
the remaining potential solutions:
1) ensure that at least one of the three std handles is bound to console
I couldn't simply find a place where all three redirections are set at once (likely done in different functions), but that's where to start looking at
BTW, your stripped-down version reads:
``` while IFS= read -u 5 -r line; do test_command done < verbs ``` I wonder if you'd rather want: ``` while IFS= read -u5 -r line; do test_command done 5< verbs ``` (maybe it's just a bad cut & paste when stripping down)
2) note: the solution 1) could be fragile if the script isn't run from a unix shell other option is to run 'wine wineconsole cmd...', but that could require moving the redirections for capturing output inside the cmd's scripts which may be quite of work
3) don't depend on chcp success/failure changing 'chcp 65001 > nul && echo %AppData%' into 'chcp 65001 > nul & echo %AppData%) should work
Also note that unicode support wrt. chcp requires some more work (see MR!6885 https://gitlab.winehq.org/wine/wine/-/merge_requests/6885), but that's an orthogonal issue