Opened 5 months ago
Last modified 5 months ago
#4020 assigned Bug
ConsoleWrite do not preserve @error
Reported by: | Zvend | Owned by: | Jon |
---|---|---|---|
Milestone: | Component: | AutoIt | |
Version: | 3.3.16.1 | Severity: | None |
Keywords: | Cc: |
Description
The helpfile for ConsoleWrite says
"The @error and @extended are not set on return leaving them as they were before calling. Usefull when debugging with the SciTE debugging output."
Sadly it is not true...
Test() ConsoleWrite(@error & @CRLF) Func Test() SetError(1, 0) ConsoleWrite("Test" & @CRLF) Return EndFunc
Attachments (0)
Change History (5)
comment:1 Changed 5 months ago by Jos
comment:2 Changed 5 months ago by anonymous
This ticket appears to be wrong... ConsoleWrite does work as documented in 3.3.16.1 !
Here's a wee better snippet demonstrating the behavior, comments say it all:
Test1() ConsoleWrite("Test1 1: " & @error & @CRLF) ; 1234, as expected, ;in versions 3.15.0/1/2/3/4, 3.16.0/1 ConsoleWrite("Test1 2: " & @error & @CRLF) ; 1234 ONLY in 3.15.4 ; and 3.16.1; notably, 0(zero) in 3.16.0! Func Test1() SetError(1234) Return EndFunc ;==>Test1 Test2() ConsoleWrite("Test2 1: " & @error & @CRLF) ; 1234 in 3.15.4 and 3.16.1, zero in other versions. ConsoleWrite("Test2 2: " & @error & @CRLF) ; 1234 in 3.15.4 and 3.16.1, zero in other versions. Func Test2() SetError(1234) ConsoleWrite("Test2 func 1: " & @error & @CRLF) ; 1234, as expected, in 3.15.0 - 3.16.1 ConsoleWrite("Test2 func 2: " & @error & @CRLF) ; 1234 in 3.15.4 and 3.16.1, zero in other versions. Return ; note the absence of SetError(@error); it's unnecessary for versions 3.15.4 and 3.16.1 ; in other versions ConsoleWrite simply does NOT preserve @error, so SetError(@error) here would be useless. EndFunc ;==>Test2
comment:3 Changed 5 months ago by anonymous
also, the title is... inadequate! this ticket has nothing to do with SetError! SetError does, and always did, work as expected/documented.
comment:4 Changed 5 months ago by Jpm
- Summary changed from SetError not working properly to ConsoleWrite do not preserve @error
comment:5 Changed 5 months ago by Jpm
- Owner set to Jon
- Status changed from new to assigned
Fix sent to Jon
Guidelines for posting comments:
- You cannot re-open a ticket but you may still leave a comment if you have additional information to add.
- In-depth discussions should take place on the forum.
For more information see the full version of the ticket guidelines here.
It looks like when a ConsoleWrite is used in the Func, the @error is not kept in the return information. These 2 versions work fine, where as the OP's script indeed doesn't work: