Skip to content

Instantly share code, notes, and snippets.

@kamichidu
Created June 14, 2013 18:20
Show Gist options
  • Save kamichidu/5784087 to your computer and use it in GitHub Desktop.
Save kamichidu/5784087 to your computer and use it in GitHub Desktop.
let g:P= vital#of('vital').import('ProcessManager')
if !g:P.is_available()
throw 'omg'
endif
" ProcessManager intented to manage interactive processes,
" thus sort prg isn't good example.
let g:p= g:P.new('erl')
echo g:P.read_wait(g:p, 4.0, ['>'])
let g:stat= g:P.status(g:p)
echo 'g:stat: '.g:stat
echo g:P.read(g:p, [])
let g:stat= g:P.status(g:p)
echo 'g:stat: '.g:stat
call g:P.writeln(g:p, 'e')
call g:P.writeln(g:p, 'd')
call g:P.writeln(g:p, 'c')
call g:P.writeln(g:p, 'b')
call g:P.writeln(g:p, 'a')
" call g:P.write(g:p, "\x1a")
" "\x04" vs '\x04', see :h expr-quote and :h expr-'
call g:P.write(g:p, "\x04")
" which one is eof character, "\x04" and "\x1a"?
call g:P.read_wait(g:p, 1.0, []) " ['', '', 'timedout']
let g:stat= g:P.status(g:p)
echo 'g:stat: '.g:stat
let g:stat= g:P.status(g:p)
echo 'g:stat: '.g:stat
call g:P.stop(g:p)
try
let g:stat= g:P.status(g:p)
catch /ProcessManager/
echo 'thrown'
endtry
" vim:ft=vim
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment