summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/commands.rs8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/commands.rs b/src/commands.rs
index aec3970e0..d1bcb4561 100644
--- a/src/commands.rs
+++ b/src/commands.rs
@@ -16,6 +16,7 @@ use zellij_utils::input::options::Options;
use zellij_utils::nix;
use zellij_utils::{
cli::{CliArgs, Command, SessionCommand, Sessions},
+ envs,
setup::{get_default_data_dir, Setup},
};
@@ -186,6 +187,13 @@ pub(crate) fn start_client(opts: CliArgs) {
attach_with_session_name(session_name, config_options.clone(), create)
};
+ if let Ok(val) = std::env::var(envs::SESSION_NAME_ENV_KEY) {
+ if val == *client.get_session_name() {
+ eprintln!("You are trying to attach to the current session(\"{}\"). Zellij does not support nesting a session in itself", val);
+ process::exit(1);
+ }
+ }
+
let attach_layout = match client {
ClientInfo::Attach(_, _) => None,
ClientInfo::New(_) => layout,