1
1
mirror of https://github.com/wez/wezterm.git synced 2024-11-22 22:42:48 +03:00

Improve exit_behavior messaging some more

This commit is contained in:
Wez Furlong 2022-04-06 17:53:46 -07:00
parent eefe4bd201
commit 6cad4c35e9
3 changed files with 12 additions and 6 deletions

View File

@ -271,10 +271,16 @@ impl Domain for LocalDomain {
let pane_id = alloc_pane_id(); let pane_id = alloc_pane_id();
cmd.env("WEZTERM_PANE", pane_id.to_string()); cmd.env("WEZTERM_PANE", pane_id.to_string());
let command_line = cmd
.as_unix_command_line()
.unwrap_or_else(|err| format!("error rendering command line: {:?}", err));
let command_description = format!( let command_description = format!(
"\"{}\" in domain \"{}\"", "\"{}\" in domain \"{}\"",
cmd.as_unix_command_line() if command_line.is_empty() {
.unwrap_or_else(|err| format!("error rendering command line: {:?}", err)), cmd.get_shell()?
} else {
command_line
},
self.name self.name
); );
let child = pair.slave.spawn_command(cmd)?; let child = pair.slave.spawn_command(cmd)?;

View File

@ -164,7 +164,7 @@ impl Pane for LocalPane {
(ExitBehavior::Close, _, _) => *proc = ProcessState::Dead, (ExitBehavior::Close, _, _) => *proc = ProcessState::Dead,
(ExitBehavior::CloseOnCleanExit, false, false) => { (ExitBehavior::CloseOnCleanExit, false, false) => {
notify = Some(format!( notify = Some(format!(
"\r\n⚠️ Process {} didn't exit cleanly.\r\n{}=\"CloseOnCleanExit\"\r\n", "\r\n⚠️ Process {} didn't exit cleanly.\r\n{}=\"CloseOnCleanExit\"\r\n",
self.command_description, self.command_description,
EXIT_BEHAVIOR EXIT_BEHAVIOR
)); ));
@ -174,12 +174,12 @@ impl Pane for LocalPane {
(ExitBehavior::Hold, success, false) => { (ExitBehavior::Hold, success, false) => {
if success { if success {
notify = Some(format!( notify = Some(format!(
"\r\n👍Process {} completed.\r\n{}=\"Hold\"\r\n", "\r\n👍 Process {} completed.\r\n{}=\"Hold\"\r\n",
self.command_description, EXIT_BEHAVIOR self.command_description, EXIT_BEHAVIOR
)); ));
} else { } else {
notify = Some(format!( notify = Some(format!(
"\r\n⚠️ Process {} didn't exit cleanly.\r\n{}=\"Hold\"\r\n", "\r\n⚠️ Process {} didn't exit cleanly.\r\n{}=\"Hold\"\r\n",
self.command_description, EXIT_BEHAVIOR self.command_description, EXIT_BEHAVIOR
)); ));
} }

View File

@ -318,7 +318,7 @@ impl CommandBuilder {
/// Determine which shell to run. /// Determine which shell to run.
/// We take the contents of the $SHELL env var first, then /// We take the contents of the $SHELL env var first, then
/// fall back to looking it up from the password database. /// fall back to looking it up from the password database.
fn get_shell(&self) -> anyhow::Result<String> { pub fn get_shell(&self) -> anyhow::Result<String> {
if let Some(shell) = self.get_env("SHELL").and_then(OsStr::to_str) { if let Some(shell) = self.get_env("SHELL").and_then(OsStr::to_str) {
return Ok(shell.into()); return Ok(shell.into());
} }