我试图在mac(10.10)上使用swift 2运行命令行工具:
let task = NSTask()
task.launchPath = "/path/to/wrong/binary"
task.launch()
// NSPipe() stuff to catch output
task.waitUntilExit()
// never reached
if (task.terminationStatus != 0){
NSLog("uh oh")
}
Run Code Online (Sandbox Code Playgroud)
由于路径错误,我的程序就死了launch path not accessible.但是,我不知道,如何捕捉到这个错误.使用do { try } catch {}around task.launch()不起作用,因为它不会抛出异常,看着terminationStatus它也无法正常工作,因为它永远不会到达.
我怎么能弄错launchPath?
Apple Swift版本2.1.1(swiftlang-700.1.101.15 clang-700.1.81)目标:x86_64-apple-darwin14.5.0
我最近使用病原体安装了vim-go,但自动完成功能无效.如果我使用它只显示我已经使用过的命令.我的.vimrc有
filetype plugin on
" Enable autocompletion
set omnifunc=syntaxcomplete#Complete
" Select keyword as you type
:set completeopt=longest,menuone
Run Code Online (Sandbox Code Playgroud)
我需要的不仅仅是这个插件吗?我到目前为止测试的另一个功能是工作(:GoRun,语法高亮).这是在Ubuntu机器上.