Quantcast
Channel: Apache Timeline
Viewing all articles
Browse latest Browse all 5648

Camel exec component and return codes from Windows batch files

$
0
0
Hi,

I'm trying to execute a .cmd batch file in Camel 2.13.1 on Windows.

My endpoint looks like this:-

from("direct:start")
.to("exec:c:\\batch-commands\\YIELDCurves.cmd?workingDir=c:\\batch-commands\\YIELDCurves.cmd")
.log("Exit code for cli execution was [${body.exitValue}]");

and I get the exitValue of 0 from the ExecResult object in the body of IN.

Now, if I want to return from the batch file with an error code e.g.

exit 1

I can't seem to get Camel to give me the '1' value in the log EIP statement
above.

I've tried using:-
- to("exec:cmd?args=c:\\batch-commands...etc but that doesn't execute the
script at all and I don't get any output other than the Microsoft Command
Interpreter message for the new cmd process and return code 0
- exit /B 1 in the batch file but that also gives return code 0 in Camel
- exit /B [1] as I saw that usage in a DOS forum, no luck
- exit [1] see above, no luck

I've exhausted the options I can see.

Anyone had any success with this?

Viewing all articles
Browse latest Browse all 5648

Trending Articles