Hi,

I have a script which calls the TurboVNC viewer, and I'm wondering whether 
there's any way for my script to determine whether the Windows version of 
TurboVNC's vncviewer.exe encountered an error or not?

When testing this from the DOS command-line, I used "start /wait" to ensure 
that vncviewer.exe ran from the same shell / thread as my other DOS commands.  
Note that ErrorLevel is not an environment variable, and "echo %ErrorLevel%" 
will not work if an environment variable called "ErrorLevel" has been set.  The 
"set ErrorLevel=" is used to remove any existing ErrorLevel environment 
variable.

C:\> set ErrorLevel=
C:\> start /wait /d "C:\Program Files\TurboVNC" vncviewer.exe invalid_host
C:\> echo %ErrorLevel%

I see an appropriate message dialog when I specify an invalid host - "Failed to 
get server address (invalid_host) …", but the exit code (ErrorLevel) still 
appears to be 0.

Below is an example to demonstrate how the "echo %ErrorLevel%" stuff is 
supposed to work, but of course this is not a GUI application... 

C:\> type test-return-code.c
#include <stdlib.h>

int main(int argc, char *argv[])
{
        return atoi(argv[1]);
}
C:\> gcc -o test-return-code.exe test-return-code.c
C:\> set ErrorLevel=
C:\> test-return-code.exe 7
C:\> echo %ErrorLevel%
7

C:\>

Thanks,
James


------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
VirtualGL-Users mailing list
VirtualGL-Users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/virtualgl-users

Reply via email to