mirror of
https://github.com/qvacua/vimr.git
synced 2024-11-24 03:25:03 +03:00
Open cli pipe file as read-write
- When vimr is `Ctrl-C`'ed, then O_WRONLY hangs.
This commit is contained in:
parent
018d3ee411
commit
d50e027402
@ -26,16 +26,18 @@ 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 fd != -1 else {
|
||||
return
|
||||
}
|
||||
|
||||
let handle = FileHandle(fileDescriptor: fd)
|
||||
handle.closeFile()
|
||||
_ = Darwin.close(fd)
|
||||
guard let cliPipePath = self.cliPipePath, FileManager.default.fileExists(atPath: cliPipePath) else {
|
||||
return
|
||||
}
|
||||
|
||||
let fd = Darwin.open(cliPipePath, O_RDWR)
|
||||
guard fd != -1 else {
|
||||
return
|
||||
}
|
||||
|
||||
let handle = FileHandle(fileDescriptor: fd)
|
||||
handle.closeFile()
|
||||
_ = Darwin.close(fd)
|
||||
}
|
||||
|
||||
func set(title: String) {
|
||||
|
Loading…
Reference in New Issue
Block a user