Set return value to 127 when command is not found
authorLukas Jiriste <ljiriste@student.42prague.com>
Fri, 30 Aug 2024 12:43:27 +0000 (14:43 +0200)
committerLukas Jiriste <ljiriste@student.42prague.com>
Fri, 30 Aug 2024 12:43:27 +0000 (14:43 +0200)
src/execution.c

index 447b4361f7621afa24d573c838eb24080ab4e4e1..79991d80624dab412aac5f9c1b21253080e1470b 100644 (file)
@@ -6,7 +6,7 @@
 /*   By: lnikolov <lnikolov@student.42prague.com    +#+  +:+       +#+        */
 /*                                                +#+#+#+#+#+   +#+           */
 /*   Created: 2024/07/21 08:57:54 by ljiriste          #+#    #+#             */
-/*   Updated: 2024/08/30 14:18:21 by ljiriste         ###   ########.fr       */
+/*   Updated: 2024/08/30 14:42:08 by ljiriste         ###   ########.fr       */
 /*                                                                            */
 /* ************************************************************************** */
 
@@ -843,7 +843,10 @@ int        ex_fields(char **fields, t_vec *assignments, const t_vec *redirections, t_ex
        else if (!contains_path(fields[0]))
                path = find_exe(fields[0], env);
        if (!path)
+       {
+               env->ret_val = 127;
                return (1);
+       }
        pid = fork();
        if (pid == 0)
        {