infor.com
concierge
infor u
developer portal
documentation central
customer center
Posts
Categories
Groups
ERPs
CSD
FSM/HRT
LN
M3
Syteline/ CSI
Hubs
Developer
Healthcare
Hospitality
Public Sector
Onboarding
Release Center
CloudSuites
Aerospace & Defense (LN)
Automotive (LN)
Chemicals (M3)
Corporate (FSM/HRT)
Distribution (Sx.e/CSD)
Distribution Enterprise (M3)
Engineering & Construction (LN)
Fashion (M3)
Food & Beverage (M3)
Healthcare (FSM/HRT)
Industrial (Syteline/CSI)
Industrial Enterprise (LN)
Manufacturing (M3)
Public Sector (FSM/HRT)
Solutions
Supply Chain Management (SCM)
Human Capital Management (HCM)
Events
Groups
User Groups
Your Groups
About
Email Community Support
Infor News
Migrated Forums
Home
Clovertech
Clovertech Archive
Read Only Archives
Cloverleaf
Cloverleaf
Can TCL call a command from command line?
System
Originally posted by Deanna Norman
Can TCL call a command from command line?
As it states...
Thanks,
Find more posts tagged with
Clovertech
Comments
System
Originally posted by Mark McDaid
Yes, you use the exec command. It's best to enclose it inside a catch command in case it errors out. Here's an example from some tcl code that I have to create a 10 second delay within a loop:
catch {exec ping 127.0.0.1 -n 10 -w 1000 > nul} err
Hope that helps.
Russ Ross
Soemtimes you will run into the case where exec will be stubborn about running a particular command line for you.
If that happens you might also try using the
system
command in TCL.
Here is a snippet that shows a working example of the TCL
system
command from wihtin one of our TCL procs that calls a command line utility (sendmail) to send an email typically to a pager in our case:
system "echo "Subject">
Here is a snippet we use that toggles off the alerts for a given thread using the touch command
system "touch ../../../Alerts/$HciConnName.off"
Here is a snippet we use that stops a given thread
system "hcicmd -p $process -c "$HciConnName pstop""
david_barr
I be careful with using "system". Cloverleaf sets up the standard output and standard error channels kind of strangely. When an engine process is run, the Tcl "stdout" and "stderr" channels are redirected to the process log file, but the Unix stdout and stderr file descriptors don't go to the log file. If you run a subprocess with either exec or system, the output of the process won't normally go to the process log file. If you use exec, you can include ">&@ stdout" in your command to have the output go to the log file. I haven't found a similar solution for the system command.