mirror of
https://github.com/qvacua/vimr.git
synced 2024-12-29 00:34:26 +03:00
wait for neovim startup
This commit is contained in:
parent
f0485f1e18
commit
705249fc4c
@ -73,8 +73,17 @@ extension NvimView {
|
||||
|
||||
self.bridge.runLocalServerAndNvim(width: size.width, height: size.height)
|
||||
|
||||
// FIXME: need to wait for listen to occur
|
||||
Thread.sleep(forTimeInterval: 0.1)
|
||||
// Wait for listen and socket creation to occur
|
||||
let timeout = Duration.seconds(4)
|
||||
let start_time = ContinuousClock.now
|
||||
while !FileManager.default.fileExists(atPath: sockPath) {
|
||||
usleep(1000)
|
||||
if ContinuousClock.now - start_time > timeout {
|
||||
self.eventsSubject.onNext(.ipcBecameInvalid(
|
||||
"Timeout waiting for neovim."))
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
// We wait here, since the user of NvimView cannot subscribe
|
||||
// on the Completable. We could demand that the user call launchNeoVim()
|
||||
|
Loading…
Reference in New Issue
Block a user