Skip to content

Commit 535783c

Browse files
committed
fix: Clarify error messages when proc-macro-srv changes working directory
I'm investigating issues where users see a load of logs of the form: ``` Failed to set the current working dir to /redacted/path. Error: Os { code: 2, kind: NotFound, message: "No such file or directory" } ``` This is tricky to debug because there's two different code paths that write exactly the same error message. Ensure they're unique.
1 parent 8ed3cca commit 535783c

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

  • crates/proc-macro-srv/src

crates/proc-macro-srv/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,7 @@ impl<'snap> EnvChange<'snap> {
328328
let prev_working_dir = std::env::current_dir().ok();
329329
if let Err(err) = std::env::set_current_dir(dir) {
330330
eprintln!(
331-
"Failed to set the current working dir to {}. Error: {err:?}",
331+
"Failed to change the current working dir to {}. Error: {err:?}",
332332
dir.display()
333333
)
334334
}
@@ -370,7 +370,7 @@ impl Drop for EnvChange<'_> {
370370
&& let Err(err) = std::env::set_current_dir(dir)
371371
{
372372
eprintln!(
373-
"Failed to set the current working dir to {}. Error: {:?}",
373+
"Failed to change the current working dir back to {}. Error: {:?}",
374374
dir.display(),
375375
err
376376
)

0 commit comments

Comments
 (0)