From 5307dc8850d82942a3da0af387d8e6c9886b6072 Mon Sep 17 00:00:00 2001 From: Julian Noble Date: Thu, 14 May 2026 13:58:57 +1000 Subject: [PATCH] punkcheck - try file deletion prior to update - attempt to workaround duplicate data issue --- src/bootsupport/modules/punkcheck-0.1.0.tm | 10 +++++++--- src/modules/punkcheck-0.1.0.tm | 10 +++++++--- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/src/bootsupport/modules/punkcheck-0.1.0.tm b/src/bootsupport/modules/punkcheck-0.1.0.tm index f92e641a..45b2a4c8 100644 --- a/src/bootsupport/modules/punkcheck-0.1.0.tm +++ b/src/bootsupport/modules/punkcheck-0.1.0.tm @@ -82,12 +82,16 @@ namespace eval punkcheck { return $record_list } proc save_records_to_file {recordlist punkcheck_file {trigger {}}} { - if {$trigger ne ""} { - puts stderr "\x1b\[36mSaving [llength $recordlist] records to file '$punkcheck_file' trigger: \x1b\[32m$trigger\x1b\[m" - } set newtdl [punk::tdl::prettyprint $recordlist] set linecount [llength [split $newtdl \n]] + + if {$trigger ne ""} { + puts stderr "\x1b\[36mSaving [llength $recordlist] records as $linecount lines to file '$punkcheck_file' trigger: \x1b\[32m$trigger\x1b\[m" + } #puts stdout $newtdl + if {[file exists $punkcheck_file] && [file type $punkcheck_file] eq "file"} { + file delete $punkcheck_file + } set fd [open $punkcheck_file w] chan configure $fd -translation binary puts -nonewline $fd $newtdl diff --git a/src/modules/punkcheck-0.1.0.tm b/src/modules/punkcheck-0.1.0.tm index f92e641a..45b2a4c8 100644 --- a/src/modules/punkcheck-0.1.0.tm +++ b/src/modules/punkcheck-0.1.0.tm @@ -82,12 +82,16 @@ namespace eval punkcheck { return $record_list } proc save_records_to_file {recordlist punkcheck_file {trigger {}}} { - if {$trigger ne ""} { - puts stderr "\x1b\[36mSaving [llength $recordlist] records to file '$punkcheck_file' trigger: \x1b\[32m$trigger\x1b\[m" - } set newtdl [punk::tdl::prettyprint $recordlist] set linecount [llength [split $newtdl \n]] + + if {$trigger ne ""} { + puts stderr "\x1b\[36mSaving [llength $recordlist] records as $linecount lines to file '$punkcheck_file' trigger: \x1b\[32m$trigger\x1b\[m" + } #puts stdout $newtdl + if {[file exists $punkcheck_file] && [file type $punkcheck_file] eq "file"} { + file delete $punkcheck_file + } set fd [open $punkcheck_file w] chan configure $fd -translation binary puts -nonewline $fd $newtdl