Skip to content

Commit

Permalink
add "nailgun" to some nailgun error messages (#16914)
Browse files Browse the repository at this point in the history
Add "nailgun" to some error messages generated by the Nailgun command runner, so that it is easier to diagnose where those error messages come from.
  • Loading branch information
Tom Dyas authored Sep 20, 2022
1 parent aa40c12 commit 0bbf1fb
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/rust/engine/process_execution/src/nailgun/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ impl CapturedWorkdir for CommandRunner {
stdin_read
})
})
.map_err(|e| format!("Error communicating with server: {}", e))
.map_err(|e| format!("Error communicating with nailgun server: {}", e))
.await?
};

Expand All @@ -270,7 +270,7 @@ impl CapturedWorkdir for CommandRunner {
let exit_code = child
.wait()
.map_ok(ChildOutput::Exit)
.map_err(|e| format!("Error communicating with server: {}", e));
.map_err(|e| format!("Error communicating with nailgun server: {}", e));

Ok(futures::stream::select(output_stream, exit_code.into_stream()).boxed())
}
Expand Down
8 changes: 4 additions & 4 deletions src/rust/engine/process_execution/src/nailgun/nailgun_pool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ impl NailgunPool {
let status = process
.handle
.try_wait()
.map_err(|e| format!("Error getting the process status! {}", e))?;
.map_err(|e| format!("Error getting the process status from nailgun: {}", e))?;
match status {
None => {
// Process hasn't exited yet.
Expand Down Expand Up @@ -297,7 +297,7 @@ fn spawn_and_read_port(
.spawn()
.map_err(|e| {
format!(
"Failed to create child handle with cmd: {} options {:#?}: {}",
"Failed to create child handle for nailgun with cmd: {} options {:#?}: {}",
&cmd, &process, e
)
})?;
Expand All @@ -314,7 +314,7 @@ fn spawn_and_read_port(
.next()
.ok_or_else(|| "There is no line ready in the child's output".to_string())
})
.and_then(|res| res.map_err(|e| format!("Failed to read from stdout: {}", e)));
.and_then(|res| res.map_err(|e| format!("Failed to read stdout from nailgun: {}", e)));

// If we failed to read a port line and the child has exited, report that.
if port_line.is_err() {
Expand All @@ -340,7 +340,7 @@ fn spawn_and_read_port(
.ok_or_else(|| format!("Output for nailgun server was unexpected:\n{:?}", port_line))?[1];
let port = port_str
.parse::<Port>()
.map_err(|e| format!("Error parsing port {}! {}", port_str, e))?;
.map_err(|e| format!("Error parsing nailgun port {}: {}", port_str, e))?;

Ok((child, port))
}
Expand Down

0 comments on commit 0bbf1fb

Please sign in to comment.