Files
clang-p2996/lldb/test/python_api/process/io/main.c
Greg Clayton b8e9b8b703 Fixed stdio redirection within LLDB to "do the right thing" in all cases.
The main issue was if you didn't specify all three (stdin/out/err), you would get file actions added to the launch that would always use the pseudo terminal. This is now fixed.

Also fixed the test suite test that handles IO to test redirecting things individually and all together and in other combinations to make sure we don't regress.

<rdar://problem/18638226>

llvm-svn: 219711
2014-10-14 20:18:05 +00:00

20 lines
669 B
C

#include <stdio.h>
int main(int argc, char const *argv[]) {
printf("Hello world.\n"); // Set breakpoint here
char line[100];
if (fgets(line, sizeof(line), stdin)) {
fprintf(stdout, "input line to stdout: %s", line);
fprintf(stderr, "input line to stderr: %s", line);
}
if (fgets(line, sizeof(line), stdin)) {
fprintf(stdout, "input line to stdout: %s", line);
fprintf(stderr, "input line to stderr: %s", line);
}
if (fgets(line, sizeof(line), stdin)) {
fprintf(stdout, "input line to stdout: %s", line);
fprintf(stderr, "input line to stderr: %s", line);
}
printf("Exiting now\n");
}