Repository navigation
Fix rust build on windows - #2019
Conversation
|
All contributors have signed the CLA ✍️ ✅ |
|
I have read the CLA Document and I hereby sign the CLA |
bolinfest
left a comment
There was a problem hiding this comment.
Thanks for this fix!
Please see comment: I would prefer tempfile::NamedTempFile unless there's a compelling reason why we can't.
| pub stderr: Arc<Mutex<Vec<u8>>>, | ||
| } | ||
|
|
||
| fn ensure_login_script(codex_home: &Path) -> std::io::Result<PathBuf> { |
There was a problem hiding this comment.
Instead of writing to CODEX_HOME, can we use tempfile::NamedTempFile in the OS temp directory? The main thing I care about is that as part of Drop, it should be deleted.
I suppose that still works if the tempfile::NamedTempFile is created in CODEX_HOME, but it's possible it won't get cleaned up in the event of a panic, so I think we should stick with the temp folder unless there is a compelling reason not to.
There was a problem hiding this comment.
No you need to return the NamedTempFile from this function so it stays alive.
| pub stderr: Arc<Mutex<Vec<u8>>>, | ||
| } | ||
|
|
||
| fn ensure_login_script(codex_home: &Path) -> std::io::Result<PathBuf> { |
There was a problem hiding this comment.
| fn ensure_login_script(codex_home: &Path) -> std::io::Result<PathBuf> { | |
| fn ensure_login_script(codex_home: &Path) -> std::io::Result<NamedTempFile> { |
|
|
||
| /// Spawn the ChatGPT login Python server as a child process and return a handle to its process. | ||
| pub fn spawn_login_with_chatgpt(codex_home: &Path) -> std::io::Result<SpawnedLogin> { | ||
| let script_path = ensure_login_script(codex_home)?; |
There was a problem hiding this comment.
I don't love the names, but:
| let script_path = ensure_login_script(codex_home)?; | |
| let script_file = ensure_login_script(codex_home)?; | |
| let script_path = script_file.path(); |
There was a problem hiding this comment.
Ah, I suppose the NamedTempFile has to be a field of SpawnedLogin for the lifetime to work out?
There was a problem hiding this comment.
Hmm, tracing this through, we would have to get this all the way to spawn_completion_poller() in codex-rs/tui/src/onboarding/auth.rs, which I admit is a bit gross. I guess we should stick with keep()?
| let (_file, path) = tmp.keep()?; | ||
| Ok(path) |
There was a problem hiding this comment.
By returning NamedTempFile, we don't have to invoke keep(), which is the goal.
|
@joshleblanc I am trying to push up my fix, but the colon in the branch name is killing me: |
|
I updated |
|
Oh, I see: I'm not used to trying to push to a branch outside my organization... |
|
OK, I'm learning a lot about GitHub today...was able to make the |
This pull request implements a fix from #2000, as well as fixed an additional problem with path lengths on windows that prevents the login from displaying.