Skip to content

Commit

Permalink
Make rust Process name extraction match Python.
Browse files Browse the repository at this point in the history
# Building wheels and fs_util will be skipped. Delete if not intended.
[ci skip-build-wheels]
  • Loading branch information
jsirois committed Apr 22, 2021
1 parent 5bbee6c commit 8f61ba1
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/rust/engine/client/src/pantsd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -143,15 +143,15 @@ pub fn probe(working_dir: &Path, metadata_dir: &Path) -> Result<u16, String> {
{
return Err(format!("The pantsd at pid {pid} is a zombie.", pid = pid));
}
let actual_command_line = process.cmd();
if actual_command_line.is_empty() {
return Err(format!(
"The command line for pantsd at pid {pid} was unexpectedly empty.",
pid = pid
));
}
let expected_process_name_prefix = pantsd_metadata.process_name()?;
let actual_argv0 = &actual_command_line[0];
let actual_argv0 = {
let actual_command_line = process.cmd();
if actual_command_line.is_empty() {
process.name()
} else {
&actual_command_line[0]
}
};
// It appears the the daemon only records a prefix of the process name, so we just check that.
if actual_argv0.starts_with(&expected_process_name_prefix) {
Ok(port)
Expand Down

0 comments on commit 8f61ba1

Please sign in to comment.