Add nixos support

This commit is contained in:
stitchy 2024-02-08 05:40:49 +00:00
parent c227ccf04e
commit 0cb189892a
Signed by: stitchy
SSH key fingerprint: SHA256:yz2SoxdnY67tfY5Jzb0f2v8f5W3o/IF359kbcquWip8

View file

@ -100,12 +100,6 @@ void inbuilt_cd(char* args) {
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
int background = 0;
if(!strncmp("&", (*array)[num_array - 1], 1)) {
@ -191,10 +185,10 @@ int run_command(char*** array, int num_array) {
}
// Spawn new Process
pid = execv(comb_string, (*array));
pid = execvp((*array)[0], (*array));
// Handle error on spawning process
perror(comb_string);
perror((*array)[0]);
exit(1);
}
@ -208,8 +202,6 @@ int run_command(char*** array, int num_array) {
if(!background)
waitpid(f, &status, 0);
free(comb_string);
return status;
}