Can anyone tell me how to discover in ObjectScript the operating system and operating system version that Caché is actually running in? (Not the operating system the build was compiled for.)
Thanks, Robert - really great to hear from you. I hope you are well.
And very interesting to learn about $systeminfo - it certainly provides a wealth of information about the environment. Unfortunately $systeminfo takes a few seconds to run, which is too slow when it might be required for many messages. I'll keep looking! If all else failsI guess I could get the information from $systeminfo when my business operation starts, and hold it in the business operation properties. So if you do happen to come across the equivalent for Linux and other platforms, please let me know.
(don't have a Caché installation at hands) but CPIPE should do it
rcemper@ubuntu:~$uname -a Linux anyServer 4.15.0-38-generic #41-Ubuntu SMP Wed Oct 10 10:59:38 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux rcemper@ubuntu:~$
You can use $version(1) to see if it is Windows (returns '2') or UNIX (returns '3'). If you want to get really fancy you can include %occOptions.inc and then use the $$$isUNIX and $$$isWINDOWS calls (which just check to see if $version(1) is 2 or 3).
Personally, I like using ##class(%Studio.SourceControl.ISC).RunCmd() as it wraps the capture of the output for parsing.
You can tie $version together the other answers into something that is platform independent (warning, I haven't tested this, but I believe the pieces work):
If ($version(1)=2) {
//Is Windows
set sc=##class(%Studio.SourceControl.ISC).RunCmd("Ver",.out,0)
set OS = out(1)
// exercise of parsing exact desired version piece from the string is an exercise left to the reader
} elseif ($version(1)=3) {
//Is UNIX
set sc=##class(%Studio.SourceControl.ISC).RunCmd("uname -a",.out,0)
set OS = out(1)
// exercise of parsing exact desired version piece from the string is an exercise left to the reader
}
from terminal and get a long printout.
If you just look for a specific line you could run the command using CPIPE and read it line by line until you get your info
details on CPIPE here: Execute Server Commands from Caché / Ensemble / IRIS
For Linux/Unix I don't have that at hands
Thanks, Robert - really great to hear from you. I hope you are well.
And very interesting to learn about $systeminfo - it certainly provides a wealth of information about the environment. Unfortunately $systeminfo takes a few seconds to run, which is too slow when it might be required for many messages. I'll keep looking! If all else failsI guess I could get the information from $systeminfo when my business operation starts, and hold it in the business operation properties. So if you do happen to come across the equivalent for Linux and other platforms, please let me know.
Windows also has Ver command:
from Caché prompt:
Linux MYSERVER 4.15.0-38-generic #41-Ubuntu SMP Wed Oct 10 10:59:38 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
something fast for WINDOWS
BuildNumber Organization RegisteredUser SerialNumber SystemDirectory Version
17134 cemper 0 0 C:\WINDOWS\system32 10.0.17134
Is there an easier way to get value from OS call then Input redirection?
check out the ##class(%Studio.SourceControl.ISC).RunCmd() method for an easy way to capture the OS output
Thanks!
I see it still uses $zf(-1) in latest instead of $zf(-100). I thought $zf(-1) is unavailable now.
It's deprecated but still available. Swapping it out for $zf(-100) for %Studio.SourceControl.ISC is on the TODO list...
and for Linux:
(don't have a Caché installation at hands) but CPIPE should do it
Linux anyServer 4.15.0-38-generic #41-Ubuntu SMP Wed Oct 10 10:59:38 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
rcemper@ubuntu:~$
You can use $version(1) to see if it is Windows (returns '2') or UNIX (returns '3'). If you want to get really fancy you can include %occOptions.inc and then use the $$$isUNIX and $$$isWINDOWS calls (which just check to see if $version(1) is 2 or 3).
Personally, I like using ##class(%Studio.SourceControl.ISC).RunCmd() as it wraps the capture of the output for parsing.
You can tie $version together the other answers into something that is platform independent (warning, I haven't tested this, but I believe the pieces work):
Hope that helps you Paul!Social networks
InterSystems resources
Log in or sign up
Log in or create a new account to continue
Log in or sign up
Log in or create a new account to continue
Log in or sign up
Log in or create a new account to continue