Wrong || evaulation in cmd.exe

Questions about Wine on Linux
Locked
aes
Newbie
Newbie
Posts: 1
Joined: Fri Jul 22, 2022 2:48 am

Wrong || evaulation in cmd.exe

Post by aes »

Hello,

There is an issue in cmd.exe || redirection: when a command exists with code 0, the commands after || gets executed anyway.

How to reproduce:

Code: Select all

reg /?
echo %errorlevel%
reg /? || echo failed
reg.exe is used as a ExitProcess(0) source. Both Windows cmd.exe and Wine print errorlevel 0, but Wine also prints "failed", and Windows does not.

Tested on wine-6.23 and wine-5.0.
jkfloris
Level 12
Level 12
Posts: 3201
Joined: Thu Aug 14, 2014 10:10 am

Re: Wrong || evaulation in cmd.exe

Post by jkfloris »

You are right. The developers are aware of this bug.
You could read the bug report for more information.
Locked