我正在尝试执行具有一些选项的程序,并将其作为输入 txt 文件。所以我尝试了这个:
set myExecutable [file join $::env(path_to_the_program) bin executable_name]
if { ![file exists $myExecutable ] } {
puts "error"
}
if { ![file executable $myExecutable ] } {
puts "error"
}
set arguments [list -option1 -option2]
set status [catch { exec $myExecutable $arguments $txtFileName } output]
if { $status != 0 } {
puts "output = $output"
}
所以它是打印:
output = Usage: executable_name -option1 -option2 <txt_file_name>
child process exited abnormally