Skip to content

Commit

Permalink
childprocess: add --stdin argument
Browse files Browse the repository at this point in the history
  • Loading branch information
madebr committed Sep 14, 2024
1 parent a1180fe commit f100fe9
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion test/childprocess.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ int main(int argc, char *argv[]) {
SDL_bool print_arguments = SDL_FALSE;
SDL_bool print_environment = SDL_FALSE;
SDL_bool stdin_to_stdout = SDL_FALSE;
SDL_bool read_stdin = SDL_FALSE;
SDL_bool stdin_to_stderr = SDL_FALSE;
int exit_code = 0;

Expand All @@ -39,6 +40,9 @@ int main(int argc, char *argv[]) {
} else if (SDL_strcmp(argv[i], "--stdin-to-stderr") == 0) {
stdin_to_stderr = SDL_TRUE;
consumed = 1;
} else if (SDL_strcmp(argv[i], "--stdin") == 0) {
read_stdin = SDL_TRUE;
consumed = 1;
} else if (SDL_strcmp(argv[i], "--stdout") == 0) {
if (i + 1 < argc) {
fprintf(stdout, "%s", argv[i + 1]);
Expand All @@ -65,6 +69,7 @@ int main(int argc, char *argv[]) {
const char *args[] = {
"[--print-arguments]",
"[--print-environment]",
"[--stdin]",
"[--stdin-to-stdout]",
"[--stdout TEXT]",
"[--stdin-to-stderr]",
Expand Down Expand Up @@ -103,7 +108,7 @@ int main(int argc, char *argv[]) {
#endif
}

if (stdin_to_stdout || stdin_to_stderr) {
if (stdin_to_stdout || stdin_to_stderr || read_stdin) {
for (;;) {
int c;
c = fgetc(stdin);
Expand Down

0 comments on commit f100fe9

Please sign in to comment.