Andromo - Start Making Apps - Free Signup

Announcement

Collapse
No announcement yet.

No value from Application.Exit(errorCode)

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • No value from Application.Exit(errorCode)

    I need TrueUpdate to return some error code if a problem occurs.

    The script I am using will return code 1013 from the client script. The very last line on the client side is Application.Exit(error);. error is 1013.

    I am testing using this process:
    1. open cmd and navigate to TrueUpdateClient.exe
    2. run TrueUpdateClient.exe and wait for program to finis.
    3. echo %ERRORLEVEL%

    ERRORLEVEL will always return 0 in command prompt. The expected ERRORLEVEL in command prompt should be 1013.

    How can I have this error code show up?

    I am using 32bit windows xp.

  • #2
    No problems here getting the desired exit code. Post your project file.

    Ulrich

    Comment


    • #3
      Attached is the tu2 file.

      Here is an example of the XML I am using:
      <?xml version='1.0' encoding='UTF-8' ?>
      <Server>
      <Version Value='1.1.1' />
      <Item>
      <File Value='patch_gray.exe' />
      <File Value='patch_blue.exe' />
      </Item>
      </Server>

      I run this file using:
      TrueUpdateClient.exe /normal /TargetVersion="1.1"
      Attached Files

      Comment


      • #4
        The script I am using will return code 1013 from the client script. The very last line on the client side is Application.Exit(error);. error is 1013.
        There is no such line at the end of the Client Script. However, there is a Application.Exit(0); at the end of the Server Script, and this is most likely what is being executed.

        I think that you need to add some debugging code and error checking.

        You load a XML document, yet you make no attempt to check if it is indeed a properly formatted XML file (or string). You should really add error checking after XML.SetXML().

        You also may want to check that g_tableFiles[] does indeed contain valid data before you proceed, attempting to run a loop on the table which may be nil.

        Lua cannot process UTF-8 encoded files, so use ANSI encoded files instead, as in <?xml version="1.0" encoding="iso-8859-1"?>.

        It might be best if you open a debug window when running the script (Debug.ShowWindow()), and enable trace mode (Debug.SetTraceMode()). Keep this window open until you reach the end of the script, where you may want to add a Dialog.Message() asking to close the application manually before any Application.Exit(), so you can check the code that was executed.

        Ulrich

        Comment


        • #5
          Thank you for your response. It seems trueupdate doesn't save the file during build, so the version I uploaded was out of date. The correct version is attached (good_version.tu2).

          As for your other comments, nothing is wrong with the script. I am purposely generating an error to test return codes. I see the downloaded files show up and execute when needed.

          The xml parses fine using encoding UTF-8, but I will use the suggested encoding type as well as adding validation.

          To test just the return code, I created a new project (test.tu2).
          The client script and server script (which shouldn't be called) consist of the same code:
          error = 20;
          TrueUpdate.WriteToLogFile(error);
          Application.Exit(error);


          After running this project, I see this in command prompt:
          C:\Test>echo %ERRORLEVEL%
          0

          C:\Test>TrueUpdateClient.exe

          C:\Test>echo %ERRORLEVEL%
          0

          and this in the generated log file:
          [04/17/2012 14:39:29] Success Update started: C:\Test\TrueUpdateClient.exe
          [04/17/2012 14:39:29] Notice Update engine version: 3.5.5.0
          [04/17/2012 14:39:30] Notice Product: patch
          [04/17/2012 14:39:30] Success Language set: Primary = 9, Secondary = 1
          [04/17/2012 14:39:30] Success Include script: _TU20_Global_Functions.lua
          [04/17/2012 14:39:30] 20[04/17/2012 14:39:30] Success Run client data event: Client Script
          [04/17/2012 14:39:30] Notice Exit update process (Return code: 20)


          In my own script, I see a similar line for Exit update process (Return code: 1013). However, Errorlevel remains 0.
          Attached Files

          Comment


          • #6
            No problems here. Perhaps you could perform your tests using a batch file to get a valid ERRORLEVEL back...


            Ulrich
            Last edited by Ulrich; 04-17-2012, 01:31 PM.

            Comment


            • #7
              I just tried a c++ program. Return value was fine there.

              I'm sure it would work as a .bat file with my program as well.

              Thanks for your help!

              Comment


              • #8
                Originally posted by s2s View Post
                I am testing using this process:
                1. open cmd and navigate to TrueUpdateClient.exe
                2. run TrueUpdateClient.exe and wait for program to finis.
                3. echo %ERRORLEVEL%
                Your test is flawed -- unless you put the "echo %errorlevel%" in a batch file -or- you use "start /w TrueUpdateClient.exe" -- it will always say 0

                Comment

                Working...
                X