Ramu Sethu wrote:
Hi
We have a build script which runs in both windows and Linux m/c. Recently i
added property to print the computer name of the m/c in which the script
runs.
Is COMPUTERNAME only for windows? Is there any workaround to print the
hostname(Linux)?
Indeed yes COMPUTERNAME is a Windows standard env variable that does not
exist on linux. env.xxxx is dangerous in a multi-os build system, as you
are accessing the underlying operating system variables, you are
therefore no longer platform independent.
You can get the hostname under linux by running the following command:
uname -n
so you should be able to retrieve the hostname with something like :
<if><equals arg1="${os.name}" arg2="Linux"/>
<then>
<exec executable="uname" outputproperty="computer.hostname">
<arg line="-n"/>
</exec>
</then>
<else>
<property name="computer.hostname" value="${env.COMPUTERNAME}"/>
</else>
</if>
We don't make any changes in the ant script when running in Linux.
Well you will have to !
Samuel.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]