Add nixos support
This commit is contained in:
parent
c227ccf04e
commit
0cb189892a
1 changed files with 2 additions and 10 deletions
|
@ -100,12 +100,6 @@ void inbuilt_cd(char* args) {
|
||||||
|
|
||||||
int run_command(char*** array, int num_array) {
|
int run_command(char*** array, int num_array) {
|
||||||
|
|
||||||
// Point all executables to /usr/bin (bad Idea but it works)
|
|
||||||
char* comb_string = malloc(sizeof(char) * 100);
|
|
||||||
sprintf(comb_string, "/usr/bin/");
|
|
||||||
strcat(comb_string, (*array)[0]);
|
|
||||||
|
|
||||||
|
|
||||||
//Check to see if the process is ran in the background
|
//Check to see if the process is ran in the background
|
||||||
int background = 0;
|
int background = 0;
|
||||||
if(!strncmp("&", (*array)[num_array - 1], 1)) {
|
if(!strncmp("&", (*array)[num_array - 1], 1)) {
|
||||||
|
@ -191,10 +185,10 @@ int run_command(char*** array, int num_array) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Spawn new Process
|
// Spawn new Process
|
||||||
pid = execv(comb_string, (*array));
|
pid = execvp((*array)[0], (*array));
|
||||||
|
|
||||||
// Handle error on spawning process
|
// Handle error on spawning process
|
||||||
perror(comb_string);
|
perror((*array)[0]);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -208,8 +202,6 @@ int run_command(char*** array, int num_array) {
|
||||||
if(!background)
|
if(!background)
|
||||||
waitpid(f, &status, 0);
|
waitpid(f, &status, 0);
|
||||||
|
|
||||||
free(comb_string);
|
|
||||||
|
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue