cleanup.go | 10 ++++++++++ doc/news.texi | 9 +++++++++ run.go | 1 - usage.go | 8 ++++---- diff --git a/cleanup.go b/cleanup.go index 243b3002fc847e1ab4031f1234a2956f5709b6367592f018b2a73686e1b91ca0..6d236faf8e1d88d8f2e3a9d6e5db0001bab536f51f2ca3416c805633928da4ca 100644 --- a/cleanup.go +++ b/cleanup.go @@ -32,6 +32,7 @@ const ( CleanupFull = "full" CleanupLog = "log" CleanupTmp = "tmp" + CleanupLock = "lock" ) var DryRun *bool @@ -68,6 +69,15 @@ switch what { case CleanupLog: if strings.HasSuffix(fi.Name(), LogSuffix) || strings.HasSuffix(fi.Name(), LogRecSuffix) { + fmt.Println(pth) + if !*DryRun { + if err = os.Remove(pth); err != nil { + return err + } + } + } + case CleanupLock: + if strings.HasSuffix(fi.Name(), LockSuffix) { fmt.Println(pth) if !*DryRun { if err = os.Remove(pth); err != nil { diff --git a/doc/news.texi b/doc/news.texi index 2ee26951b854101f2d86232737bbc0686b18d24d485dab94be1ac3147ac51e96..3c0e77f76add46f3c1132b99604da1a35d7737b2872acc193637a9be27500338 100644 --- a/doc/news.texi +++ b/doc/news.texi @@ -2,6 +2,15 @@ @node News @cindex news @unnumbered News +@anchor{Release 1_28_0} +@section Release 1.28.0 +@itemize +@item + Do not remove @file{.lock} files, that leads to possible races + between running targets. Although @command{nncp-cleanup lock} + can be used to cleanup. +@end itemize + @anchor{Release 1_27_1} @section Release 1.27.1 @itemize diff --git a/run.go b/run.go index 56325494341dce6a993d801d3a04ca2d90218fd7921344affc2458643fcec050..24a1c675cbf525fbc62d5991e18579e1b2333c36bf347537753d4ce13648891f 100644 --- a/run.go +++ b/run.go @@ -577,7 +577,6 @@ lockRelease() os.Remove(fdDep.Name()) os.Remove(fdStdout.Name()) os.Remove(tmpPath) - os.Remove(fdLock.Name()) if FdStatus != nil { if _, err = FdStatus.Write([]byte{StatusDone}); err != nil { log.Fatalln(err) diff --git a/usage.go b/usage.go index 4fe42216230bc3b89b9ccf877d631f6a0fcc4ab6f32733eeeaaa699a10de7317..9d99f8e30ef0b660573a6b12da958bdb0feaf64b7f3003b410a77549ea8806c6 100644 --- a/usage.go +++ b/usage.go @@ -24,7 +24,7 @@ "os" ) const ( - Version = "1.27.1" + Version = "1.28.0" Warranty = `Copyright (C) 2020-2022 Sergey Matveev This program is free software: you can redistribute it and/or modify @@ -62,10 +62,10 @@ d = `Usage: redo-always Always build current target. Unusable outside .do.` case CmdNameRedoCleanup: - d = `Usage: redo-cleanup [-n] {full,log,tmp} [...] + d = `Usage: redo-cleanup [-n] {full,log,lock,tmp} [...] -Remove either all goredo's related temporary files, or kept stderr -logs, or everything (including .redo directories) related.` +Remove either all of goredo's related temporary files, or kept stderr +logs, or lock files, or everything (including .redo directories) related.` case CmdNameRedoLog: d = `Usage: redo-log [-c] [-r] target [ | tai64nlocal ]