Module: wine Branch: master Commit: 58d21b3319f719b4d0b6972a801b5f81993d5c10 URL: https://source.winehq.org/git/wine.git/?a=commit;h=58d21b3319f719b4d0b6972a8...
Author: Jason Edmeades us@edmeades.me.uk Date: Mon Aug 27 20:41:50 2018 +0100
cmd: Handle single line 'if' as nested if or with redirects.
A single line if statement causes problems when it has redirects and/or continuation type operators (|, &&, || etc) because it is expected that if there is more than one command in the 'if', then it will use brackets. This patch changes the 'if' parsing to emulate brackets at a continuation character. In addition, 'for' and 'if' statements do not have their output redirected immediately, instead it is redirected on the individual commands being executed not the statement itself. We were opening the redirect once for the 'if' and once for the processing of the statement inside the if.
Signed-off-by: Jason Edmeades us@edmeades.me.uk Signed-off-by: Alexandre Julliard julliard@winehq.org
---
programs/cmd/builtins.c | 16 +- programs/cmd/tests/test_builtins.cmd | 9 + programs/cmd/tests/test_builtins.cmd.exp | 7 +- programs/cmd/wcmdmain.c | 309 +++++++++++++++++-------------- 4 files changed, 200 insertions(+), 141 deletions(-)
Diff: https://source.winehq.org/git/wine.git/?a=commitdiff;h=58d21b3319f719b4d0b69...