Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions loader/directory_refresher.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ func (d *DirectoryRefresher) WatchDirectory(runtimePath string, appDirPath strin
}

func (d *DirectoryRefresher) ShouldRefresh(path string, op FileSystemOp) bool {
if filepath.Base(path) == d.currDir &&
op == Write || op == Create || op == Chmod {
if filepath.Dir(path) == d.currDir &&
(op == Write || op == Create || op == Chmod) {
return true
}
return false
Expand Down
13 changes: 13 additions & 0 deletions loader/loader_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -158,4 +158,17 @@ func TestDirectoryRefresher(t *testing.T) {

snapshot = loader.Snapshot()
assert.Equal("hello2", snapshot.Get("file2"))

// Write to the file
f, err := os.OpenFile(appDir+"/file2", os.O_RDWR, os.ModeAppend)
assert.NoError(err)
_, err = f.WriteString("hello3")
assert.NoError(err)
f.Sync()

// Wait for the update
<-runtime_update

snapshot = loader.Snapshot()
assert.Equal("hello3", snapshot.Get("file2"))
}