Matt
Matt

Reputation: 5567

Phing syntax error on exec using "less than" character

I am having problems with malformed XML in my phing build file. I want to have a task that will gunzip a file and then pipe it to mysql to restore a database backup. I have found that having the "<" symbol in the command causes errors.

Here is my current line that is breaking the build script:

<exec command="gunzip < ${mysql.backup} | mysql -u ${mysql.username} -p ${mysql.password} ${mysql.database}"
            logoutput="true" checkreturn="true" />

Output:

BUILD FAILED
exception 'BuildException' with message 'Error reading project file [wrapped: /home/ec2-user/project/build.xml:206:30: > required]' in /usr/share/pear/phing/parser/ProjectConfigurator.php:197

Is there someway to escape the command="" part?

Or a better way to do this?

Upvotes: 2

Views: 1276

Answers (1)

Hugh
Hugh

Reputation: 8932

Less than signs not starting elements should be escaped; using &lt; is the easiest way to do this in your case.

Upvotes: 2

Related Questions