为什么我必须在ant脚本中为exec输入两次数据?

时间:2023-01-24 17:07:12

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

在以下ant build.xml片段中,我正在执行rsync操作。 rsync命令提示输入密码。

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>

1 个解决方案

#1


0  

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.

也许在shell中已经设置的一些环境变量值在ant脚本中是不可访问的,例如。 RSYNC_RSH,RSYNC_PASSWORD。您可以通过相应的选项(如-e或--password-file)设置这些变量/值,或者通过ant的env元素在任务中设置这些变量。

#1


0  

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.

也许在shell中已经设置的一些环境变量值在ant脚本中是不可访问的,例如。 RSYNC_RSH,RSYNC_PASSWORD。您可以通过相应的选项(如-e或--password-file)设置这些变量/值,或者通过ant的env元素在任务中设置这些变量。