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();
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!(
"\"{}\" in domain \"{}\"",
cmd.as_unix_command_line()
.unwrap_or_else(|err| format!("error rendering command line: {:?}", err)),
if command_line.is_empty() {
cmd.get_shell()?
} else {
command_line
},
self.name
);
let child = pair.slave.spawn_command(cmd)?;

View File

@ -164,7 +164,7 @@ impl Pane for LocalPane {
(ExitBehavior::Close, _, _) => *proc = ProcessState::Dead,
(ExitBehavior::CloseOnCleanExit, false, false) => {
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,
EXIT_BEHAVIOR
));
@ -174,12 +174,12 @@ impl Pane for LocalPane {
(ExitBehavior::Hold, success, false) => {
if success {
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
));
} else {
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
));
}

View File

@ -318,7 +318,7 @@ impl CommandBuilder {
/// Determine which shell to run.
/// We take the contents of the $SHELL env var first, then
/// 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) {
return Ok(shell.into());
}