Skip to content
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

Process cleanup #805

Merged
merged 3 commits into from
Nov 29, 2021
Merged

Process cleanup #805

merged 3 commits into from
Nov 29, 2021

Conversation

th1000s
Copy link
Collaborator

@th1000s th1000s commented Nov 27, 2021

  • Test sibling process detection
  • Match process binary case insensitively (e.g. Git.exe)
  • Clean up FakeParentArgs, now has once, for_scope, or with

Scope(T),
With(usize, Rc<Vec<T>>),
None,
Invalid,
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would Exhausted or Used or Consumed be a better name?

(The code here is all quite sophisticated by my Rust standards so I'm really just trying to understand the PR and may not have great suggestions.)

}
pub fn get() -> Option<Vec<String>> {
FAKE_ARGS.with(|a| {
let old_value = a.replace_with(|old_value| match old_value {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would let new_value = a.replace_with... be a better name?

calling_process_cmdline(ProcInfo::new(), blame::guess_git_blame_filename_extension);
}
calling_process_cmdline(ProcInfo::new(), guess_git_blame_filename_extension);
}
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that this module is getting to the point where it would be easier to understand if we separated the abstract machinery (e.g. ProcessInterface, calling_process_cmdline , FakeParentArgs) from the concrete clients (determine_calling_process, git_blame_filename_extension). E.g. I feel that this test is starting to mix up testing git blame and FakeParentArgs logic. Happy for that to be done in subsequent PRs though.

where_
);
}
}
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These interior mutability pointer tricks are new to me, very nice! I'd heard of them while reading Blandy & Orendorff but hadn't tried to understand code using them before. Your comment above was sufficient though to explain what was going on, if taken slowly.

Copy link
Owner

@dandavison dandavison left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great, and very educational. I made couple of comments -- let me know if you want to change anything or if I should merge first.

#807 is branched off this branch, although not in any meaningful way yet.

@dandavison dandavison merged commit 1c9be71 into dandavison:master Nov 29, 2021
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.

2 participants