Skip to content

Commit

Permalink
Check if Node.js is installed before spawning.
Browse files Browse the repository at this point in the history
  • Loading branch information
reid committed Oct 20, 2010
1 parent 988d49d commit 76ffa2e
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions componentbuild/shared/targets.xml
Expand Up @@ -47,10 +47,23 @@
<http url="${node.jslint.url}"/>
</not>
<then>
<echo level="info">Attempting to start NodeJS app at: ${src}</echo>
<exec executable="node" spawn="true" failonerror="false">
<arg value="${src}"/>
<!-- You can't set failifexecutionfails if spawn is true. Argh. -->
<!-- Check if it's installed first. -->
<exec resultproperty="node.status" executable="node" failonerror="false" failifexecutionfails="false" searchpath="true" resolveexecutable="true">
<arg value="-v"/>
</exec>
<if>
<equals arg1="${node.status}" arg2="0"/>
<then>
<echo level="info">Spawning Node.js app at: ${src}</echo>
<exec executable="node" spawn="true" failonerror="false" searchpath="true" resolveexecutable="true">
<arg value="${src}"/>
</exec>
</then>
<else>
<echo level="info">For faster builds, install Node.js.</echo>
</else>
</if>
<!-- Don't fail if node doesn't exist, fails to start, etc.
We will fallback to the slow Rhino engine later. -->
</then>
Expand Down

0 comments on commit 76ffa2e

Please sign in to comment.