sheredom / subprocess.h

🐜 single header process launching solution for C and C++
The Unlicense
1.12k stars 97 forks source link

out of date process_create doc in readme #5

Closed xoorath closed 6 years ago

xoorath commented 6 years ago

Readme informs to create a process like so:

const char command_line[] = {"echo", "\"Hello, world!\"", NULL};
struct process_s process;
int result = process_create(command_line, &process);
if (0 != result) {
  // an error occurred!
}

however process_create takes an integer bitfield of process_option_e.

The code also has const char command_line[] = {"echo", "\"Hello, world!\"", NULL};, which isn't valid at least on msvc. Needed to be changed to const char* command_line[] = {"echo", "\"Hello, world!\"", NULL}; (note the type)

After making this change and providing process_option_e::process_option_combined_stdout_stderr and 0, both times this example code gives me a -1 result, and the exit code is -1.

sheredom commented 6 years ago

Good catch!