exectd/tests/02_execute.c

21 lines
561 B
C

#include "../include/exectd.h"
int main() {
// Arguments for the ls command
char *argv[] = {"ls", "-l", "-a", NULL};
// Custom environment variables
char *envp[] = {
"MY_ENV_VAR=example",
"PATH=/usr/bin:/bin", // Ensure PATH is set for executable lookup
NULL
};
int status = execute_job("/bin/ls", argv, envp);
if (status != 0) {
// Handle error
printf("my_execve returned error code: %d\n", status);
}
// Code here will run after the child process has finished
return 0;
}