我有過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?