-
Notifications
You must be signed in to change notification settings - Fork 585
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Exit code suggestion - to discuss and review whether to add exit code #731
Comments
Similar problem here: my tagui script is launched by an external process and I need to monitor if any error happened during the automation (for example if wrong credentials are provided). Like this:
I tried using in my script this.exit(1) and also setting btw, this also happens when there's an error in the script (for example read can't find a path). The exit code is always 0. Am I missing something? Is there a way to set the exit code in my tagui script? Thank you for your support and for your work, tagui is awesome! |
Thanks @muratcim for sharing and @youleaf for your kind words! The exit code from TagUI is aimed to detect whether error happens during parsing of the human language script into working JavaScript code. Thus running this.exit(1) from the script will not pass on the exit code 1. Looping my colleague @siowyisheng into this discussion. Yi Sheng, what do you think of having the ability to have custom exit codes in TagUI script? Is this something you would like to have in v6.x / v7? If this is to be implemented, probably a new step is needed, eg Above are 2 different examples, first way is detect 'ERROR' keyword in the output log file, second way is to invoke exit code from script. Right now if an error happens during automation TagUI simply exit with this.exit() with no error code. |
If this can be useful, at the following link you'll find standard exit codes in glibc (adopted by linux, *bsd and also osx that doesn't use glibc). AFAIK, windows uses different exit codes though. Didn't know 1 was used for script parsing errors. This is useful and perfectly makes sense; anyway being able to catch run errors too would be great in use cases where script launch is automated. |
Bumping my colleague @siowyisheng for inputs |
Hi Guys, I've looked at this. Some findings - The current architecture does not support exiting with error level 1 even if there is an error, for example an element not found. Similarly, doing a In order to both capture log files and also output the automation execution to screen, the execution is piped into the tee command. However, that means that the error level returned back would be the error level of tee command which is 0, and never 1, even if explicitly set. macOS / Linux
Windows
However, @muratcim method should be doable even in v6, by hijacking log file before it is deleted by default. The following lines should do the job, by adding to just before log files are deleted. Windows
macOS / Linux
|
Fyi Guys, above has been implemented with above commit. Now available with latest cutting edge version - https://github.com/kelaberetiv/TagUI/archive/master.zip |
Hi @youleaf for your block of code, the following should work now and return errorlevel 1 - TagUI v6
|
Hi @kensoh
Exit code returns 0 by default when there is no syntax problem in a code.My suggestion is when exit code is different from 0 when an error is received in the project.Because when a cron job or windows task scheduler is defined, a different value than exit code 0 can be warned.
For this I have added the following code in the tagui.cmd file.
The text was updated successfully, but these errors were encountered: