0

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

0

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

https://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

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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