Skip to content

fix(cli): stop leaking a session cache tempdir per build - #5811

Open
gaetschwartz wants to merge 1 commit into
DioxusLabs:mainfrom
gaetschwartz:fix/cli-session-cache-dir-leak
Open

fix(cli): stop leaking a session cache tempdir per build#5811
gaetschwartz wants to merge 1 commit into
DioxusLabs:mainfrom
gaetschwartz:fix/cli-session-cache-dir-leak

Conversation

@gaetschwartz

Copy link
Copy Markdown

Summary

BuildRequest::new builds its session cache dir with TempDir::new().into_path(), which
disarms the guard, so every dx invocation leaves one directory per build target in $TMPDIR
permanently. This restores RAII by holding either an owned Arc<TempDir> or the
caller-supplied --session-cache-dir path.

Regression from #4602, which changed the field from Arc<TempDir> to PathBuf and dropped
flush_session_cache().

// before
let session_cache_dir = args.session_cache_dir.clone()
    .unwrap_or_else(|| TempDir::new().unwrap().into_path());

// after
let session_cache_dir = match args.session_cache_dir.clone() {
    Some(path) => SessionCacheDir::Provided(path),
    None => SessionCacheDir::Owned(Arc::new(TempDir::new().context(..)?)),
};

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant