Phing Exec Task and Argument Escaping

Phing Exec Task and Argument Escaping

Recently I needed to run a script on server via SSH. To automate things I wanted to execute the script via Phing. The command I wanted to execute looked like this:

ssh myuser@remotehost "/home/myuser/bin/ -d /tmp"

Executing the command above via the Phing Exec returned a wired error. After diving deep into the Phing sources I realized that Phing tries to escape the arguments which at some point simply messes things up. I spend some more time debugging things and came across the escape attribute of the exec task which in the end help me to fix my problem. As it turns out, this is how you need to invoke the exec task in this case:

<exec executable="ssh"
    <arg value="myuser@remotehost" />
    <arg value="/home/myuser/bin/ -d /tmp" />

Eintrag von Stephan Hochdörfer am 28.07.2014

Tags: Phing, PHP

Diese Webseite verwendet Cookies, um die Bedienfreundlichkeit zu erhöhen. Mit der Nutzung unserer Webseite wird das Einverständnis erklärt, dass wir Cookies verwenden. Weitere Informationen.