2012-07-10 28 views
2

我有過Maruku運行我的降價文件時,我將它們保存在jEdit的BeanShell的宏:EXEC()中的BeanShell宏導致的jEdit掛起,當它返回非零退出代碼

if (buffer.getMode().toString().equals("markdown")) { 
    cmd = "C:\\Ruby\\bin\\maruku.bat -o " + buffer.getDirectory() + buffer.getName().replaceAll("markdown$", "html") + " " + buffer.getPath(); 
    exec(cmd); 
} 

這個偉大的工程時Markdown文件是有效的。但是如果我犯了一個錯誤,jEdit就會永遠等待exec()的電話「成功」,這永遠不會。當這種情況發生,我要殺死的jEdit的javaw.exe過程,在命令行手動運行Maruku發現的錯誤,例如:

E:\docs>maruku mydoc.markdown 

___________________________________________________________________________ 
| Maruku tells you: 
+--------------------------------------------------------------------------- 
| Could not find ref_id = "17" for md_link(["17"],"17") 
| Available refs are [] 
+--------------------------------------------------------------------------- 
!C:/Ruby/lib/ruby/gems/1.8/gems/maruku-0.6.0/lib/maruku/errors_management.rb:49:in `maruku_error' 
!C:/Ruby/lib/ruby/gems/1.8/gems/maruku-0.6.0/lib/maruku/output/to_html.rb:716:in `to_html_link' 
!C:/Ruby/lib/ruby/gems/1.8/gems/maruku-0.6.0/lib/maruku/output/to_html.rb:970:in `send' 
!C:/Ruby/lib/ruby/gems/1.8/gems/maruku-0.6.0/lib/maruku/output/to_html.rb:970:in `array_to_html' 
!C:/Ruby/lib/ruby/gems/1.8/gems/maruku-0.6.0/lib/maruku/output/to_html.rb:961:in `each' 
\___________________________________________________________________________ 
Not creating a link for ref_id = "17". 

然後我重新啓動的jEdit,更正錯誤,並重新保存文件,在這點宏觀成功。

我該如何讓自己的宏更有彈性地去死(顯示Maruku的錯誤輸出),或者至少默默地死去,所以我不必殺死jEdit?

回答

0

我用我的宏內部略有不同的調用執行系統命令:

Runtime.getRuntime().exec("asdf"); 

當我運行此,JEDIT給了我一個彈出: Jedit popup on <code>exec</code> failure

我跑JEDIT 4.4 .1與JDK 1.6.0_26。

0

這裏有可能涉及到ErrorList插件,併發生死鎖。 The bug已修復,但修正尚未發佈。無論如何,在錯誤跟蹤器中,您可能會發現問題的解決方法。

相關問題