exectd/tests/03_shell.c

16 lines
587 B
C

#include "../include/exectd.h"
int main() {
char *argv[] = {"/bin/ping", "-c","3","myrepos.dev", NULL}; // Example arguments
char *envp[] = {NULL}; // Example environment variables
int fd = ext_open("tests/bin/stdout_dup", O_WRONLY | O_CREAT);
int fd2 = ext_open("tests/bin/stderr_dup", O_WRONLY | O_CREAT);
int status = shell_job("/bin/ping", argv, envp, fd, fd2);
if (status != 0) {
// Handle error
printf("Shell job returned error code: %d\n", status);
}
// Code here will run after the child process has finished
return 0;
}