+ Reply to Thread
Results 1 to 2 of 2
  1. #1
    Junior Member
    Join Date
    Mar 2008
    Posts
    2

    Return code from .exe to cygwin perl

     
    I'm in a perl script trying to get a return code from an .exe in cygwin.
    All I can get is an 8bit return code (-128) --> (127) [a signed byte].

    Perl gets the return code back through the special variable "$?" which
    is 16bits but gets shifted 8bits (>>8) to retrieve the return code.

    Is there a way that anyone knows of that I can get a larger return code (ie. a short 16bit or a long 32bit)?

    This perl script is a converted batch program that used %ERRORLEVEL%.
    Apparently it could return values greater than 8 bits.

    Any help is greatly appreciated!

  2. #2
    Junior Member
    Join Date
    Mar 2008
    Posts
    2

    Talking Solved - Used a Wrapper Cmd File

    Caller.pl --> Wrapper.cmd --> hello.exe
    hello.exe returns the input parameter.

    Wrapper.cmd
    ----------------------
    @%1 %2 %3 %4 %5 %6 %7 %8 %9
    @echo %ERRORLEVEL%

    Caller.pl
    -----------------
    #!/usr/bin/perl
    my $code = 'c:/executables/hello.exe';
    my @out = `./Wrapper.cmd "$code" 1234`;
    my $rc = pop @out;
    print " return code = $rc\n";
    print "\nThe Program Output Follows Here:\n";
    print join '',@out;;

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. i386\ntkrnlmp.exe error code is 4
    By LizP in forum Applications and Operating Systems
    Replies: 5
    Last Post: February 7th, 2012, 05:04 PM
  2. Replies: 0
    Last Post: March 2nd, 2004, 11:24 AM
  3. can cygwin replace explorer.exe?
    By e980238 in forum Applications and Operating Systems
    Replies: 3
    Last Post: July 25th, 2003, 02:09 PM
  4. Cygwin/Mingw problem
    By Jüš† ä gü¥ in forum Webmastering and Programming
    Replies: 3
    Last Post: November 23rd, 2002, 06:21 PM
  5. COde of PERL for URL hide
    By frankbarlake in forum Webmastering and Programming
    Replies: 0
    Last Post: November 19th, 2002, 12:08 AM

Tags for this Thread

Posting Permissions

  • You may post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Recommended Sites: ResellerRatings Store Reviews