简体   繁体   English

使用Phing在Windows上回显换行文件

[英]Echo linebreak to file using Phing on Windows

In my build script I'm trying to output the date and SVN revision number to a file in the build directory. 在我的构建脚本中,我正在尝试将日期和SVN修订号输出到构建目录中的文件。 I would like the date and revision number on separate line, but can't get a linebreak to output to the file. 我想在单独的行上的日期和修订号,但无法获得输出到文件的换行符。 I've tried all sorts of methods: 我尝试过各种各样的方法:

    <echo file="${build.dir}\build.txt">DATE = ${DATE} \r\n \\\r\\\n PHP_EOL</echo>
    <echo msg="DATE: ${DATE} \r\n \\\r\\\n PHP_EOL 0x0D0A SVN revision: ${svn.lastrevision} . PHP_EOL" file="${build.dir}\build.txt" append="true" />

Has anyone else managed to get a linebreak through to file with Phing? 有没有其他人设法通过Phing提交换行? I've looked at the code in phing, and it uses fwrite. 我查看了phing中的代码,它使用了fwrite。 I can only guess the strings in my build.xml are getting escaped in some way before being handled by fwrite? 我只能猜测我的build.xml中的字符串在被fwrite处理之前会以某种方式被转义?

I guess I may have to resort to using ExecTask? 我想我可能不得不求助于使用ExecTask?

您可以使用${line.separator} ,请参阅内置属性文档

<echo msg="DATE: ${DATE}${line.separator}SVN revision: ${svn.lastrevision}${line.separator}" file="${build.dir}\build.txt" append="true" />

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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