X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=Usermode%2FApplications%2FCLIShell_src%2Fmain.c;h=6de92df42d99804328e83ec3cf86e74025ad2b8c;hb=13078002b01ee4f63eb2001d2ef479a2a006ea32;hp=8088a2142b3e1ea8337e5649cbda9481d80e4a5c;hpb=d676fcc8adbfd1150c20b18b747853bc53ea432e;p=tpg%2Facess2.git diff --git a/Usermode/Applications/CLIShell_src/main.c b/Usermode/Applications/CLIShell_src/main.c index 8088a214..6de92df4 100644 --- a/Usermode/Applications/CLIShell_src/main.c +++ b/Usermode/Applications/CLIShell_src/main.c @@ -9,6 +9,7 @@ #include "header.h" #include #include +#include #define _stdin 0 #define _stdout 1 @@ -56,7 +57,7 @@ int main(int argc, char *argv[], char **envp) gasEnvironment = envp; - Command_Clear(0, NULL); +// Command_Clear(0, NULL); { char *tmp = getenv("CWD"); @@ -213,14 +214,28 @@ void CallCommand(char **Args) // Create new process int fds[] = {0, 1, 2}; + int status; pid = _SysSpawn(sTmpBuffer, (const char **)Args, (const char **)gasEnvironment, 3, fds, NULL); if(pid <= 0) { printf("Unable to create process: `%s'\n", sTmpBuffer); // Error Message + status = 0; } else { - int status; + _SysIOCtl(0, PTY_IOCTL_SETPGRP, &pid); _SysWaitTID(pid, &status); } + + // Return terminal to a sane state + { + int zero = 0; + _SysIOCtl(0, PTY_IOCTL_SETPGRP, &zero); + printf("\x1b[0m"); + } + // Print a status message if termination was non-clean + if( status ) + { + printf("[%i] exited %i\n", pid, status); + } } /**