Author Topic: Mac OS X: Suppress output to terminal window  (Read 6403 times)

jkwuc89

  • Senior Community Member
  • Posts: 199
  • Hero Points: 6
Mac OS X: Suppress output to terminal window
« on: July 15, 2011, 02:33:11 PM »
I use the following shell script to start SlickEdit from a terminal window on OS X:

export VSLICKXNOPLUSNEWMSG=1
${SLICKEDITHOME}/Contents/MacOS/vs $* & > /dev/null 2>&1
osascript -e 'tell application "X11" to activate
tell application "System Events"
    tell process "X11"
        tell menu bar 1
            tell menu bar item "Window"
                tell menu "Window"
                    click menu item 10
                end tell
            end tell
        end tell
    end tell
end tell' > /dev/null 2>&1
exit 0

After starting SlickEdit, the following output appears inside my terminal window:

macOSX_InitializeXquartz: Using DISPLAY of /tmp/launch-0LFVEK/org.macosforge.xquartz:0
2011-07-15 09:53:58.410 vs[3769:903] The primary instance of SlickEdit has exited

Is there any way to suppress this output?

Matthew

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 990
  • Hero Points: 44
Re: Mac OS X: Suppress output to terminal window
« Reply #1 on: July 15, 2011, 02:55:39 PM »
There's not a way to turn that logging off. It's using NSLog, so it can go to the Console (and not stdout) if you launch the app via the .app bundle. Rather than invoking the vs executable directly, would you be able to simply use the open command in your script?
> open -n -a SlickEditV1600 --args +new

jkwuc89

  • Senior Community Member
  • Posts: 199
  • Hero Points: 6
Re: Mac OS X: Suppress output to terminal window
« Reply #2 on: July 15, 2011, 04:02:19 PM »
How do I get the following command to accept file names as command line arguments?
open -n -a SlickEditV1600 --args +new

When I ran open -n -a SlickEditV1600 --args +new SlickEdit.sh from a terminal, SlickEdit attempted to open /SlickEdit.sh and not SlickEdit.sh from the current working directory.  Also, repeating this command opened a new SlickEdit window instead of reusing the existing one.


Matthew

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 990
  • Hero Points: 44
Re: Mac OS X: Suppress output to terminal window
« Reply #3 on: July 15, 2011, 05:10:19 PM »
The -n tells the operating system to start a new instance, and the +new is for SlickEdit to understand that it is a new instance. If you just want to open the first instance or activate the existing running instance just use
open -a SlickEditV1600

In the open command, file paths come right after the application name, so if you're just opening files (and don't need any other SlickEdit-specific command line args), you don't need the --args stuff. So you would use
> open -a SlickEditV1600 ./*.sh
or
> open -a SlickEditV1600 file1.sh file2.sh
And the file paths will be interpreted as relative to the Terminal shell's current directory.
« Last Edit: July 15, 2011, 05:12:11 PM by Matthew »

jkwuc89

  • Senior Community Member
  • Posts: 199
  • Hero Points: 6
Re: Mac OS X: Suppress output to terminal window
« Reply #4 on: July 15, 2011, 05:22:47 PM »
Thanks!  The latest command line examples did the trick.