Commits (2)
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -319,8 +319,16 @@ impl<'a> InteractiveShell<'a> {
let cmd_permissions = fs::metadata(command[0].as_str()).unwrap().permissions();
// Let's get the unix permissions for this file
let unix_perms = UnixPermissions::from(cmd_permissions.mode() as u16);
// Now we get the mode string
eprintln!("Could not execute command {}\nThe current permissions of this command are: {}.\n\nTry running chmod +x [FILE]", command[0], unix_perms.to_string());
if unix_perms.user_mode.execute
|| unix_perms.group_mode.execute
|| unix_perms.other_mode.execute {
eprintln!("{} is executable but not by you.\nCurrent permissions: {}\n\nTry running chmod +x [FILE]",
command[0], unix_perms.to_string());
} else {
eprintln!("{} not marked as executable\nCurrent permissions: {}.\n\nTry running chmod +x [FILE]",
_ => eprintln!("ion: Error executing command: {}", err),
......@@ -428,9 +436,9 @@ impl ToString for UnixMode {
// A structure which stores Unix Permissions.
pub struct UnixPermissions {
user_mode: UnixMode,
group_mode: UnixMode,
other_mode: UnixMode,
pub user_mode: UnixMode,
pub group_mode: UnixMode,
pub other_mode: UnixMode,
impl ToString for UnixPermissions {