You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm debugging my PR for color_eyre at the moment. For some reason, the source code lines were not printed out.
The reason was, that I'm using a workspace and that tracing_core::metadata::Metadata contains a file path relative to the workspace, not my current working directory.
So I'm in "$workspace/color_eyre" and execute a test.
This line is then executed because filename is "color-spantrace/tests/color_schemes.rs" – which is relative to the workspace, not my current working directory:
// `filename` can't be found, because it's relative to the workspacelet file = matchFile::open(filename){Ok(file) => file,// return without printing the source:Err(ref e)if e.kind() == ErrorKind::NotFound => returnOk(()),
e @ Err(_) => e.unwrap(),};
I believe this is only a problem for people who work on color_spantrace, and not for end-users who install color_spantrace via cargo (but I'm not 100% sure).
I'm reporting this in case there is an easy workaround (I can't see one), or in case this could lead to problems for end-users.
Feel free, to close this if you don't think this is a problem.
Maybe a note in the README for people who want to work on color_spantrace would make sense?
The text was updated successfully, but these errors were encountered:
Aah yea, I have a PR that attempts to fix this but I never figured out the proper way to resolve the relative paths we should be searching in and ended up forgetting about the PR, I should really try to finish that one...
I think Cargo should offer the root directory of the current base directory (the workspace or the standalone dir) as an environment variable, but it seems this doesn't exist.
Maybe OUT_DIR or CARGO_MANIFEST_DIR could be used to derive the right directory?
pksunkara
changed the title
print_source_if_avail: can't extract source if working dir is crate in workspace
color-spantrace: print_source_if_avail: can't extract source if working dir is crate in workspace
Mar 30, 2024
Hi,
I'm debugging my PR for
color_eyre
at the moment. For some reason, the source code lines were not printed out.The reason was, that I'm using a workspace and that tracing_core::metadata::Metadata contains a file path relative to the workspace, not my current working directory.
So I'm in "$workspace/color_eyre" and execute a test.
This line is then executed because
filename
is "color-spantrace/tests/color_schemes.rs" – which is relative to the workspace, not my current working directory:I believe this is only a problem for people who work on
color_spantrace
, and not for end-users who installcolor_spantrace
via cargo (but I'm not 100% sure).I'm reporting this in case there is an easy workaround (I can't see one), or in case this could lead to problems for end-users.
Feel free, to close this if you don't think this is a problem.
Maybe a note in the README for people who want to work on
color_spantrace
would make sense?The text was updated successfully, but these errors were encountered: