Pipes in Phing exec task
Asked Answered
S

1

6

I'm trying to implement a decent random string generator in my buildfile using the following ExecTask :

<exec command="cat /dev/urandom | tr -cd '[:alnum:]' | fold -w30 | head -n1" returnProperty="random" />

While this works fine when run on the command line, it causes my build script to just hang when I try and call it from Phing. I've tried various escape patterns to no avail. What am I doing wrong?

Seko answered 29/11, 2013 at 12:21 Comment(0)
C
0

Try setting the escape to false. Also, you might want to try to use passthru.

<exec escape="false" passthru="true" command="cat /dev/urandom | tr -cd '[:alnum:]' | fold -w30 | head -n1" returnProperty="random" />

Here is the phing documentation, with the available options you can pass to exec.

https://www.phing.info/docs/guide/trunk/ExecTask.html

And when should you use passthru.

PHP - exec() vs system() vs passthru()

Caren answered 30/10, 2015 at 19:45 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.