简体   繁体   中英

Why do I have to enter data twice for exec in ant scripts?

In the following ant build.xml snippet, I am performing an rsync operation. The rsync command prompts for a password.

The problem is, when it prompts for the password, I enter it once, hit enter, and nothing happens. So I type it again (second time) and hit enter, then it works.

It's strange to me that I have to enter it twice and I don't understand why?

<!-- Define a target which publishes the final build apk to the test server. -->
<target name="upload" depends="release">
        <exec executable="rsync" dir="${basedir}">
                <arg value="--stats"/>
                <arg value="--progress"/>
                <arg value="-vaz"/>
                <arg value="bin/myfile.apk"/>
                <arg value="root@target:/path/to/backupfolder"/>
        </exec>
</target>

Maybe some environment variables values already set in the shell are not accessable in the ant script, eg. RSYNC_RSH, RSYNC_PASSWORD. You can set those variables/values via the corresponding options like -e or --password-file, or set those variables inside the task via the env element of ant.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM