summaryrefslogtreecommitdiffstats
path: root/zellij-server
diff options
context:
space:
mode:
authorAram Drevekenin <aram@poor.dev>2022-10-20 20:16:46 +0200
committerGitHub <noreply@github.com>2022-10-20 20:16:46 +0200
commite62bb93df3a5d8f910491bfed8aea2463d5a0dec (patch)
tree3cd3da58e3a5d3deab665c0e56797888429fcae7 /zellij-server
parentebc4222d6af7734e346dcf00442422cadfe5cdf6 (diff)
fix(layouts): various bugs and better errors (#1831)
* fix(layout): error on percent size 0 * fix(command): better error on invalid commands * fix(layouts): better error on unknown pane nodes * fix(layouts): disallow certain template names * style(fmt): rustfmt
Diffstat (limited to 'zellij-server')
-rw-r--r--zellij-server/src/os_input_output.rs8
1 files changed, 5 insertions, 3 deletions
diff --git a/zellij-server/src/os_input_output.rs b/zellij-server/src/os_input_output.rs
index 29b7c75a8..9a8ce0088 100644
--- a/zellij-server/src/os_input_output.rs
+++ b/zellij-server/src/os_input_output.rs
@@ -104,12 +104,13 @@ fn command_exists(cmd: &RunCommand) -> bool {
let command = &cmd.command;
match cmd.cwd.as_ref() {
Some(cwd) => {
- if cwd.join(&command).exists() {
+ let full_command = cwd.join(&command);
+ if full_command.exists() && full_command.is_file() {
return true;
}
},
None => {
- if command.exists() {
+ if command.exists() && command.is_file() {
return true;
}
},
@@ -117,7 +118,8 @@ fn command_exists(cmd: &RunCommand) -> bool {
if let Some(paths) = env::var_os("PATH") {
for path in env::split_paths(&paths) {
- if path.join(command).exists() {
+ let full_command = path.join(command);
+ if full_command.exists() && full_command.is_file() {
return true;
}
}