TCL - 尝试并行执行 proc 但出现奇怪的 Java 错误

问题描述

我正在按照这里的示例进行操作 https://wiki.tcl-lang.org/page/Execute+in+Parallel+and+Wait 但是当我运行这样一个简单的代码时,我得到一个错误:子进程异常退出错误是“错误:找不到或加载主类 引起:java.lang.classNotFoundException:"

    for {set i 0} {$i < 5} {incr i} {
        set script {            
            puts hello
        }
        set chan [open |[list [info nameofexecutable] <<$script 2>@stderr]]     
        dict set res $chan command $script
        fconfigure $chan -blocking 0
        lappend background $chan
    }
    
    while 1 {
        foreach chan $background {
            if {[eof $chan]} {
                fconfigure $chan -blocking 1
                if {[set idx [lsearch -exact $background $chan]] >= 0} {
                    set background [lreplace $background $idx $idx]
                }
                catch [close $chan] cres copts
                dict set res $chan result $cres
                dict set res $chan options $copts
            } else {
                puts -nonewline [read $chan]
            }
        }
        if {[llength $background] == 0} {
            break
        }
        after 100
    }
    return $res
}

}

当我尝试通过在 forloop 中运行此执行语句以稍微不同的方式运行并行进程时收到类似的消息

exec [info nameofexecutable] $variable_of_path_to_script << [list proc_name $param1 $param2] 2>@stderr

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)