views:

45

answers:

1

How can I execute following command line code in an ant build file?

    cd backend/doctrine/
    export PC_ZEND_ENV=testing
    php doctrine migrations:migrate << EOF
    y
    EOF

The solution

With the feedback I've got I figured out the following working exec command.

<exec dir="backend/doctrine" executable="php">
    <env key="PC_ZEND_ENV" value="development" />
    <arg line="doctrine migrations:migrate" />
    <arg value="&lt;&lt; Y" />
</exec>
+3  A: 

Use the exec task. The result should be something like the following (untested):

<exec dir="backend/doctrine" executable="./doctrine">
    <arg line="migrations:migrate << EOF"/>
    <env key="PC_ZEND_ENV" value="testing"/>
</exec>
krock
Thx this helped me allot further. Now I only have a problem with the << sign.
Skelton
@Skelton, you could try escaping the `<<` by using `<<`.
krock
Sagar
Thanks for the feedback. I've added the solution.
Skelton