Question #235511 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/235511

markshao posted a new comment:
Hey RaiMan


    I still get the exception when I execute the sikuli through ANT from 
jenkins.

The piece of the sikuli script is :

    if exists("1377257662744.png"):
        captureScreen()
        wait(5)
        click("1377257674028.png")
        App.close('xCP Designer')
        print 'Delopyment fail and get the error dialog'
        exit(2)

    # another error message
    if exists("1378691970944.png"):
        captureScreen()
        wait(2)
        click("1378691994428.png")
        App.close('xCP Designer')
        print 'The problems found when running the application'
        exit(3)

Now I directly using the exit() function other than the sys.exit()

I using ANT to trigger the sikuli script as following

<target name="deploy">
                <exec executable="cmd" 
dir="${env.USERPROFILE}/Desktop/Sikuli-IDE-1.0.0-Win32" failonerror="true" 
resultproperty="isGood">
                    <arg line="/c sikuli-script -j6 -r 
${env.USERPROFILE}\Desktop\scripts_folder\deployment.sikuli"/>
                </exec>
                <echo message="[Ant] The deployment process exit code is 
${isGood}"/>
                <if>
                        <equals arg1="${isGood}" arg2="0" />
                        <then>
                                <echo message="[Ant] The deployment action is 
ok"/>
                        </then>
                        <else>
                                <fail>
                                        <echo message="[Ant] The deployment 
action fail"/>
                                </fail>
                        </else>
                </if>   
        </target>

The field "isGood" is used to store the exit code of sikuli process ,
and the build.xml file is triggered by jenkins using ANT, but I found
the some strange things in the console log of the jenkins

    [exec] Traceback (most recent call last):
     [exec]   File 
"C:\Users\user\Desktop\scripts_folder\deployment.sikuli\deployment.py", line 
103, in <module>
     [exec]     exit(2)
     [exec]   File 
"C:\Users\user\Desktop\Sikuli-IDE-1.0.0-Win32\sikuli-script.jar\Lib\sikuli\Sikuli.py",
 line 210, in exit
     [exec]     sys.exit(code)
     [exec] SystemExit: 2
     [exec] [info] Exit code: 1
     [echo] [Ant] The deployment process exit code is 0
     [echo] [Ant] The deployment action is ok

First strange thing is that why the sikuli script throw the exception
when call the exit(2) method . And the echo message from ant still get
the 0 exit code . But before that It shows that the Exit code is 1 . But
in fact I exit the process with the code 2.

Could you help give me some advices about it ? I hope I can get the exit
2 code from the outside process.

Thanks .

-- 
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.

_______________________________________________
Mailing list: https://launchpad.net/~sikuli-driver
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~sikuli-driver
More help   : https://help.launchpad.net/ListHelp

Reply via email to