Windows development using input-output through

Cecil

19+ years progress programming and still learning.
OE: 11.7.2
OS: Windows 10 Pro 64

If I execute the curl command on Windows command line, I get an error 6 code as expected.

Code:
C:\Users\James>curl somerandomdomainnamehere.com & echo %errorlevel%
curl: (6) Could not resolve host: lkjksdf.com
6

However, If I execute the same command in the ABL using INPUT-OUTPUT THROUGH, it returns 0 (zero). This is not the expected result. Normally I do this kind of thing on Linux without a problem. What I'm I missing.?

Code:
DEFINE STREAM curlStream.

INPUT-OUTPUT STREAM curlStream THROUGH "curl somerandomdomainnamehere.com & echo %errorlevel%".

DEFINE VARIABLE serverResponseLineImport AS CHARACTER   NO-UNDO.

DEFINE VARIABLE errorLevel AS CHARACTER   NO-UNDO.

REPEAT:
    serverResponseLineImport = "".

    IMPORT STREAM curlStream UNFORMATTED serverResponseLineImport.

         
    errorLevel = serverResponseLineImport.

END.

INPUT-OUTPUT STREAM curlStream CLOSE.

MESSAGE errorLevel.
 

Cecil

19+ years progress programming and still learning.
Solved the problem by having the wrap the curl command into a batch file and then executing the batch file. The batch file would then echo the error level.
 
Top