Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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

1 Answer 1

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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.