EasyManua.ls Logo

COBHAM GRMON3 - Page 207

COBHAM GRMON3
239 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
GRMON3-UM
June 2019, Version 3.1.0
207 www.cobham.com/gaisler
99. usrsh - syntax
NAME
usrsh - Run commands in threaded user shell
SYNOPSIS
usrsh
usrsh subcommand ?arg?
DESCRIPTION
The usrsh command is used to create custom user shells. Each custom shell has an associated Tcl interpreter
running in a separate thread. Log output from a custom user shell is prefix with its name (see description of the
-log option in Section 3.2.3, “General options”).
usrsh
usrsh list
List all custom user shells.
usrsh add name
Create a user shell named name. The name is used as an identifier for the shell when using other usrsh
commands.
usrsh delete name
Delete user shell name.
usrsh eval ?-bg? ?-std? name arg ?arg ...?
Evaluate command arg in the user shell identified as name. If a script is running, then the command will
fail with the error code set to EBUSY.
If the option -bg is set, then the script will be evaluated in the background, and GRMON will return to
the prompt.
If the option -std, in combination with option -bg, then output from the background operation will be
forwarded to the current shells stdout.
usrsh result name
Retrieve the result from the last evaluation. If a script is running, then the command will fail with the error
code set to EBUSY.
RETURN VALUE
Upon successful completion usrsh list will return a list of all custom user shells.
usrsh eval will return the result from the script. If the option -bg then nothing will be returned. Instead the usrsh
result will return the result when the script is finished.
EXAMPLE
Create a user shell named myshell and evaluate a command in it.
grmon3> usrsh add myshell
Added user shell: myshell
grmon3> usrsh eval myshell puts "Hello World!"
Hello World!
Evaluate command in user shell named myshell in the background and wait for it to finish.
grmon3> usrsh eval -bg myshell {after 2000; expr 1+1}
grmon3> while {[catch {usrsh result myshell}] && $errorCode == "EBUSY"} {puts "waiting"; after 1000}
waiting
waiting
grmon3> puts [usrsh result myshell]
2

Table of Contents