You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Chris Melikian <ch...@melikian.net> on 2014/10/10 12:19:54 UTC
Camel exec component and return codes from Windows batch files
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?
--
View this message in context: http://camel.465427.n5.nabble.com/Camel-exec-component-and-return-codes-from-Windows-batch-files-tp5757466.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Camel exec component and return codes from Windows batch
files
Posted by Willem Jiang <wi...@gmail.com>.
If you cannot get the result form commons exec, we cannot do anything in camel :(
--
Willem Jiang
Red Hat, Inc.
Web: http://www.redhat.com
Blog: http://willemjiang.blogspot.com (English)
http://jnn.iteye.com (Chinese)
Twitter: willemjiang
Weibo: 姜宁willem
On October 13, 2014 at 6:50:33 PM, Chris Melikian (chris@melikian.net) wrote:
> Hi William, thanks for your reply.
>
> I've download the commons exec 1.2 source and the test cases fail where the
> exit code is being tested. On the web site it says Windows 7 64-bit
> Professional passes all test cases for Java6. I tried both 6 and 7 and both
> fail.
>
> I'll have to look for an alternative. Any ideas?
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Camel-exec-component-and-return-codes-from-Windows-batch-files-tp5757466p5757512.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
Re: Camel exec component and return codes from Windows batch files
Posted by Chris Melikian <ch...@melikian.net>.
Hi William, thanks for your reply.
I've download the commons exec 1.2 source and the test cases fail where the
exit code is being tested. On the web site it says Windows 7 64-bit
Professional passes all test cases for Java6. I tried both 6 and 7 and both
fail.
I'll have to look for an alternative. Any ideas?
--
View this message in context: http://camel.465427.n5.nabble.com/Camel-exec-component-and-return-codes-from-Windows-batch-files-tp5757466p5757512.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Camel exec component and return codes from Windows batch
files
Posted by Willem Jiang <wi...@gmail.com>.
camel exec is based on common-exec.
Can you just try the your script just as the tutorial does?
[1]http://commons.apache.org/proper/commons-exec/tutorial.html
--
Willem Jiang
Red Hat, Inc.
Web: http://www.redhat.com
Blog: http://willemjiang.blogspot.com (English)
http://jnn.iteye.com (Chinese)
Twitter: willemjiang
Weibo: 姜宁willem
On October 10, 2014 at 6:20:21 PM, Chris Melikian (chris@melikian.net) wrote:
> 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?
>
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Camel-exec-component-and-return-codes-from-Windows-batch-files-tp5757466.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>