Forum OpenACS Development: command line calls

Collapse
Posted by Matthew Taylor on
I am trying to call the dot program from within OpenACS.
the call I want to make is "/sw/bin/dot -Tsvg file.dot -o file.svg"
I havent yet found out how to do this in tcl
Collapse
2: Re: command line calls (response to 1)
Posted by Rocael Hernández Rizzardini on
Collapse
3: Re: command line calls (response to 1)
Posted by Andrew Piskorski on
From Tcl you need to use either exec, or open with a command pipeline (e.g., '[open "|ls -l"]'). Depending on exactly what you want to accomplich, one or the other may work better for you. Typically you want exec.

If the command line want to use is dynamically constructed or otherwise complicated, you may also want to use eval in constructing it. But it's either exec or open that you need to do the actual work of running the executable.

If you're new to Tcl, there are some subtleties to making best use of exec, open, and eval that will not be obvious or even clear to you at first (e.g., using a catch around programs that write to stdout, or dynamic construction of command lines), but basic use of exec is simple and straightforward.