Skip to content
Snippets Groups Projects
Commit 777db9a5 authored by Yorhel's avatar Yorhel
Browse files

Minor fixes to new shell feature

The check for the system() exit status is slightly problematic, because
bash returns the status code of the last command it executed. I've set
it to only check for status code 127 now (command not found) in order to
at least provide a message when the $SHELL command can't be found. This
error can still be triggered when executing a nonexistant command within
the shell and then exiting.
parent a25e5f80
No related branches found
No related tags found
No related merge requests found
......@@ -103,5 +103,6 @@ int input_handle(int);
#include "help.h"
#include "path.h"
#include "util.h"
#include "shell.h"
#endif
......@@ -32,7 +32,7 @@
int page, start;
#define KEYS 16
#define KEYS 17
char *keys[KEYS*2] = {
/*|----key----| |----------------description----------------|*/
"up, k", "Move cursor up",
......
......@@ -34,7 +34,7 @@
#include <unistd.h>
void shell_draw() {
char *full_path, *shell;
char *full_path;
int res;
/* suspend ncurses mode */
......@@ -60,7 +60,7 @@ void shell_draw() {
/* resume ncurses mode */
reset_prog_mode();
if (res == -1 || WEXITSTATUS(res) != 0) {
if (res == -1 || !WIFEXITED(res) || WEXITSTATUS(res) == 127) {
clear();
printw("ERROR: Can't execute shell interpreter: %s\n"
"\n"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment