Skip to content

Instantly share code, notes, and snippets.

@fatih
Created September 21, 2016 20:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fatih/92177876c3ea1bea124766311286b9d6 to your computer and use it in GitHub Desktop.
Save fatih/92177876c3ea1bea124766311286b9d6 to your computer and use it in GitHub Desktop.
func! CloseHandler(channel)
while ch_status(a:channel) == 'buffered'
echomsg ch_read(a:channel)
endwhile
endfunc
let job = job_start(['go', 'build'], {'close_cb': 'CloseHandler'})
package main
func main() {
a
b
c
}
@fatih
Copy link
Author

fatih commented Sep 21, 2016

Gives error:

image

@haya14busa
Copy link

channel activity log.

call ch_logfile('/tmp/channellog', 'w')
==== start log session ====
  0.000021 : Starting job: go  build
  0.000039 on 1: Created channel
  0.000574 : looking for messages on channels
  0.040895 RECV on 1: '# local/haya14busa/tmp
./main.go:4: undefined: a
./main.go:5: undefined: b
./main.go:6: undefined: c
'
  0.041631 ERR on 1: channel_select_check(): Cannot read from channel, will close it soon
  0.041639 : looking for messages on channels
  0.041641 on 1: Closing channel because of previous read error
  0.041643 on 1: Closing channel
  0.041652 on 1: Invoking callbacks before closing
  0.041654 on 1: Invoking close callback CloseHandler
  0.043392 : looking for messages on channels
  1.453627 on 1: Dropping message '# local/haya14busa/tmp
./main.go:4: undefined: a
./main.go:5: undefined: b
./main.go:6: undefined: c
'
  1.453638 : looking for messages on channels
  8.063839 on 1: Job ended
  8.064224 : looking for messages on channels

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment