Nikita Savchenko · Jan 1, 2017

Is it Possible to Change the Current Device to be Terminal?

Hello community!

After reading a lot near InterSystems's Jobs and Terminal I/O documentation sections multiple times, I still does not understand one concept.

Maybe this question will be kind of incorrect, but please take it as is: is it possible to change the current device to be terminal device?

Let me explain what I want to achieve.

I have a jobbed process, which current/principle device is //./nul:6932, and which is spawned by TCP device |TCP|1972|936. And for the jobbed process I want almost-everything to behave exactly the same way as it behaves for Caché TERM. This particular thing  ##class(%Library.Device).GetType() returns 6, as it should be for null device, but I need this method to return 1 in the child process, as it is for terminal device.

Is it even possible to achieve this result by changing the current device somehow?

One concept I come up with is this:

write $IO
open ?
use ?
write ##class(%Library.Device).GetType() ; I want this to print 1 :)
close ?

But I cannot figure out how to make this work (?) and is it even the right way to go.

I would be happy for any help or explanations on this. Thank you!

0 300
Discussion (2)1
Log in or sign up to continue

You can define your own device of terminal type (also see System  - Configuration - Devices you can see other defined Cache terminals) :

Thanks for hint, Edward, but how can I start using it? open 3564 use 3564 write ##class(%Library.Device).GetType() close 3564 command throws <NOTOPEN> exception.