1
1
mirror of https://github.com/qvacua/vimr.git synced 2024-11-24 11:37:32 +03:00

Open cli pipe file as read-write

- When vimr is `Ctrl-C`'ed, then O_WRONLY hangs.
This commit is contained in:
Tae Won Ha 2018-07-01 14:27:56 +02:00
parent 018d3ee411
commit d50e027402
No known key found for this signature in database
GPG Key ID: E40743465B5B8B44

View File

@ -26,8 +26,11 @@ extension MainWindow {
self.set(dirtyStatus: false)
self.emit(self.uuidAction(for: .close))
if let cliPipePath = self.cliPipePath {
let fd = Darwin.open(cliPipePath, O_WRONLY)
guard let cliPipePath = self.cliPipePath, FileManager.default.fileExists(atPath: cliPipePath) else {
return
}
let fd = Darwin.open(cliPipePath, O_RDWR)
guard fd != -1 else {
return
}
@ -36,7 +39,6 @@ extension MainWindow {
handle.closeFile()
_ = Darwin.close(fd)
}
}
func set(title: String) {
self.window.title = title