Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am trying to open a new terminal window in mac and execute a node command via ant

   <exec osfamily="unix" dir="${dir}" executable="open" failonerror="true">
            <env key="MONGODB_HOST" value="${mongo.host}"/>
            <env key="MONGODB_DATABASE" value="${mongo.dbname}"/>
            <arg line="-a Terminal ."/>
        </exec>
   <exec osfamily="unix" dir="${dir}" executable="node" failonerror="true">
            <arg line="${app.file.name}.js "/>
        </exec>

However the second exec executes within the old terminal window and not the new one that is opened by the first exec

Can anyone please guide me as to how I can execute the second exec within the context of the new terminal window

I am trying to emulate the basic functionality of

  • opening a new terminal window

  • setting environment variables

  • and executing node server.js

via the ant command on a mac

share|improve this question

i was finally able to do it using the following shell scripts and calling them from ant :)

http://stackoverflow.com/questions/1589114/opening-a-new-terminal-tab-in-osxsnow-leopard-with-the-opening-terminal-window

#!/bin/sh
pwd=`pwd`
osascript -e "tell application \"Terminal\" to do script \"cd $pwd; clear\"" > /dev/null

and

#!/bin/sh

pwd=`pwd`
osascript -e "tell application \"Terminal\"" \
    -e "tell application \"System Events\" to keystroke \"t\" using {command down}" \
    -e "do script \"cd $pwd; clear\" in front window" \
    -e "end tell"
    > /dev/null
share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .