-
Notifications
You must be signed in to change notification settings - Fork 91
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
R exists unexpectedly when calling file.edit() many times #1885
Comments
Reprex: path <- fs::dir_create(tempfile())
for (i in 1:50) {
fs::file_create(fs::path(path, i))
}
fs::dir_ls(path) |> purrr::walk(file.edit) Or more simply: path1 <- file.create(tempfile())
path2 <- file.create(tempfile())
repeat { file.edit(path1); file.edit(path2) } Useful actions in the right-click menu of an editor tab after opening many temp files: Close all others / Close to the right That's weird I could reproduce the first time, and then in fresh sessions I no longer can reproduce. |
See also #857 |
Somewhat related to #1956 as well |
I've been investigating this and can reproduce it pretty well with @lionel-'s fs example. Notably, the problem goes away when you insert an early exit in the (seemingly unrelated) diagnostics code right before this Here is what I think is happening:
|
@DavisVaughan Good findings! One way to fix this would be to introduce a mechanism to "yield" from We'd replace the I'm not familiar with how tokio/futures work in Rust but I've read that Rust futures are lazy and need to be actively polled. It's not like Javascript where you create a promise and it's immediately scheduled on the event loop and goes on to live its own life even if you don't need the result. So there might be a need to keep alive the future until it has resolved, or keep polling it from the select, or block on it from another thread, or something like that. |
In Positron 2024.01.0 (Universal) build 141 I can edit SO MANY FILES 😳 so-many-files.movLooking fantastic! 🎉 |
Positron Version:
Positron Version: 2023.11.0 (Universal) build 1319
Code - OSS Version: 1.84.0
Commit: 7a0546f
Date: 2023-11-20T03:10:05.995Z
Electron: 25.9.2
ElectronBuildId: undefined
Chromium: 114.0.5735.289
Node.js: 18.15.0
V8: 11.4.183.29-electron.0
OS: Darwin arm64 22.6.0
Steps to reproduce the issue:
fs::dir_ls(regexp = "qmd$") |> purrr::walk(file.edit)
Kapture.2023-11-23.at.09.23.17.mp4
What did you expect to happen?
For it not to crash. I use this idiom all the time when i write and work
Were there any error messages in the output or Developer Tools console?
The text was updated successfully, but these errors were encountered: