Studio Tip - running COS Commands from Output

I wanted to share a little tidbit which is in the Studio documentation (http://docs.intersystems.com/cache20152/csp/docbook/DocBook.UI.Page.cls?...) but many people who have been using the InterSystems Studio for a long time missed the addition of this *very* useful feature, and every time I mention this to an audience  I see at least one face light up because of how excited they are to learn about it!

Within Studio, the Output pane (View -> Output) is actually misnamed.  It is actually an Input/Output window which can be used to run Caché ObjectScript commands!  See the following example:

A very nice advantage of this is that the Caché ObjectScript is run within the context of the OS user that Caché is running as, which means that file permissions, etc are the same as a studio process (this is very helpful when using the source control hooks).

Two cavaat that I know of:

1) You can't run the Read Caché ObjectScript command from this window

2) You can't ! out to the OS like you can from a regular csession

I hope that some people have their faces light up when they read this because it is an exciting and very powerful feature that they didn't know existed :)

 

Comments

As an alternative you can use Cache Web terminal.

Download xml, import it with help of Caché Studio into any namespace and get terminal in the browser with:

http://server:57772/terminal/

1) You can run read command.

2) And you can run some routines with VT-100 terminal UI

Source code

 

 

I never knew that...

Now the question is about Atelier of course ;)

I guess I could extend the Atelier talks to?

Atelier has a similar feature in its debugging context that allows for execution of COS. We are also integrating a built in terminal.

A few more caveats:

  • It's not that you can't use the READ command, but that the command completes immediately with emptystring, i.e. "". So beware of running certain command-line utilities. For example, if you connect Studio to %SYS and D ^LOCKTAB in the Output pane you're trapped in an endless loop and have to terminate your Studio.
  • If anything you run releases all locks with an argumentless LOCK command, any Studio locks will also be gone. I've sometimes wished COS allowed us to protect the locks of our process in the same way as we can NEW our local variables.
  • Issuing the H or HALT command is a surefire way of ending your Studion session.

In addition the caveats John already mentioned, keep in mind that this is a session into the serverside context of studio. So not only can you 'end' studio, you can really really mess with it, leading to unexpected and mostly deadly results. Deadly for studio and maybe open documents that is :)