aboutsummaryrefslogtreecommitdiff
path: root/lib/mlibc/tests/posix/posix_spawn.c
diff options
context:
space:
mode:
authorIan Moffett <ian@osmora.org>2024-03-07 17:28:52 -0500
committerIan Moffett <ian@osmora.org>2024-03-07 18:24:51 -0500
commitf5e48e94a2f4d4bbd6e5628c7f2afafc6dbcc459 (patch)
tree93b156621dc0303816b37f60ba88051b702d92f6 /lib/mlibc/tests/posix/posix_spawn.c
parentbd5969fc876a10b18613302db7087ef3c40f18e1 (diff)
build: Build mlibc + add distclean target
Signed-off-by: Ian Moffett <ian@osmora.org>
Diffstat (limited to 'lib/mlibc/tests/posix/posix_spawn.c')
-rw-r--r--lib/mlibc/tests/posix/posix_spawn.c38
1 files changed, 0 insertions, 38 deletions
diff --git a/lib/mlibc/tests/posix/posix_spawn.c b/lib/mlibc/tests/posix/posix_spawn.c
deleted file mode 100644
index cc5ccff..0000000
--- a/lib/mlibc/tests/posix/posix_spawn.c
+++ /dev/null
@@ -1,38 +0,0 @@
-#include <stdlib.h>
-#include <assert.h>
-#include <stdio.h>
-#include <string.h>
-
-#include <unistd.h>
-#include <spawn.h>
-#include <sys/wait.h>
-
-extern char **environ;
-
-void run_cmd(char *cmd)
-{
- pid_t pid;
- char *argv[] = {"sh", "-c", cmd, NULL};
- int status;
- printf("Run command: %s\n", cmd);
- status = posix_spawn(&pid, "/bin/sh", NULL, NULL, argv, environ);
- if(status == 0) {
- printf("Child pid: %i\n", pid);
- if(waitpid(pid, &status, 0) != -1) {
- printf("Child exited with status %i\n", status);
- printf("Child exit status: %i\n", WEXITSTATUS(status));
- assert(WEXITSTATUS(status) == 0);
- } else {
- perror("waitpid");
- assert(0 == 1);
- }
- } else {
- printf("posix_spawn: %s\n", strerror(status));
- assert(0 == 1);
- }
-}
-
-int main() {
- run_cmd(":");
- return 0;
-}