Skip to content

Commit

Permalink
Merge pull request #331 from metrumresearchgroup/clean-fix
Browse files Browse the repository at this point in the history
clean: fix handling of files from *_copied.json
  • Loading branch information
kyleam authored Aug 23, 2024
2 parents dc9e22c + 4a7834c commit b182773
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 7 deletions.
16 changes: 14 additions & 2 deletions cmd/clean.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,16 +110,28 @@ func clean(cmd *cobra.Command, args []string) error {

if !filesOnly {
for _, f := range matchedFolders {
if !filepath.IsAbs(f) {
f = filepath.Join(dir, f)
}
// explicitly ignoring errors here, as this is not critical
// and it's more important to try than to succeed
_ = AppFs.RemoveAll(filepath.Join(dir, f))
err = AppFs.RemoveAll(f)
if err != nil {
log.Printf("failed to remove directory %s: %v", f, err)
}
}
}
if !dirsOnly {
for _, f := range matchedFiles {
if !filepath.IsAbs(f) {
f = filepath.Join(dir, f)
}
// explicitly ignoring errors here, as this is not critical
// and it's more important to try than to succeed
_ = AppFs.Remove(filepath.Join(dir, f))
err = AppFs.Remove(f)
if err != nil {
log.Printf("failed to remove file %s: %v", f, err)
}
}
}

Expand Down
2 changes: 0 additions & 2 deletions cmd/nonmem.go
Original file line number Diff line number Diff line change
Expand Up @@ -645,8 +645,6 @@ func extrapolateCopyFilesFromExtensions(filename string, level int) []string {
}

extensions[2] = []string{
".clt",
".coi",
".clt",
".coi",
".cpu",
Expand Down
2 changes: 1 addition & 1 deletion integration/nmless/bbi_clean_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ func TestCleanCopiedRuns(tt *testing.T) {
writeCopied(t, filepath.Join(dir, "run10"),
[]runner.TargetedFile{
{
File: "run10.baz",
File: filepath.Join(dir, "run10.baz"),
},
},
)
Expand Down
2 changes: 0 additions & 2 deletions runner/consts.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,6 @@ func EstOutputFilesByRun(r string) map[string]int {
"_RMAT.msf",
}
fileExtsLvl2 := []string{
".clt",
".coi",
".clt",
".coi",
".cpu",
Expand Down

0 comments on commit b182773

Please sign in to comment.