Your pipeline is not working because the shell session you start needs an actual command to leave the ObjectScript shell, and the documented way to exit that shell is HALT or H, not QUIT/Q. QUIT exits the current ObjectScript context, but not the shell itself. [1]
For running commands from a script, the retrieved material shows using csession rather than cache for this kind of non-interactive execution. Examples shown include:
csession cache "##class(%SYSTEM.OBJ).ShowFlags()"- piping a script file:
cat myScript.scr | csession CACHE - a here-document:
csession cacheuc1 << EOF write ##class(%SYSTEM.Version).GetVersion(),! halt EOF
[[2]](https://community.intersystems.com/post/call-csession-execute-method-and-output-results)
If you want to launch a routine or method and then return control to the shell, use `HALT`/`H` at the end of the ObjectScript input. [[1]](https://community.intersystems.com/post/how-do-i-type-q-shell-script-exit-status)[[2]](https://community.intersystems.com/post/call-csession-execute-method-and-output-results)
For background execution specifically, `JOB` is an asynchronous ObjectScript command, and one retrieved example shows that when using a system class call with `JOB`, the supported syntax is the full class invocation form such as:
```objectscript
JOB ##class(%SYSTEM.OBJ).Export(...)
rather than relying on shorthand forms in that context. [3]
So the practical direction supported by the retrieved material is:
- Feed commands to
csession, notcache. [2] - End the fed ObjectScript with
HALTorH. [1][2] - If you need background work, use proper
JOBsyntax. [3]
Example pattern from the retrieved material:
csession CACHE << EOF
zn "PL"
...your ObjectScript...
halt
EOF
Or:
cat myScript.scr | csession CACHE
Sources:
- Log in to post comments