Skip to content

Commit

Permalink
fix stream close issue
Browse files Browse the repository at this point in the history
  • Loading branch information
inv2004 committed Oct 10, 2024
1 parent 214fcd1 commit e692fc9
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion aur/PKGBUILD
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
pkgname=ttop
pkgver=1.5.2
pkgver=1.5.3
pkgrel=2
pkgdesc="System monitoring tool with historical data service, triggers and top-like TUI"
url="https://github.com/inv2004/ttop"
Expand Down
2 changes: 1 addition & 1 deletion src/ttop/blog.nim
Original file line number Diff line number Diff line change
Expand Up @@ -162,14 +162,14 @@ proc save*(): FullInfoRef =
let buf = compress(result[].toJson())
let blog = saveBlog()
let file = open(blog, fmAppend)
defer: file.close()
if flock(file.getFileHandle, 2 or 4) != 0:
writeLine(stderr, "cannot open locked: " & blog)
quit 1
defer: discard flock(file.getFileHandle, 8)
let s = newFileStream(file)
if s == nil:
raise newException(IOError, "cannot open " & blog)
defer: s.close()

s.saveStat result
s.write buf.len.uint32
Expand Down
2 changes: 1 addition & 1 deletion ttop.nimble
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Package

version = "1.5.2"
version = "1.5.3"
author = "inv2004"
description = "Monitoring tool with historical snapshots and alerts"
license = "MIT"
Expand Down

0 comments on commit e692fc9

Please sign in to comment.