-
Notifications
You must be signed in to change notification settings - Fork 28
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make stdin a psuedoterminal when isatty is set #1265
base: master
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -147,10 +147,17 @@ int main(int argc, char **argv) { | |
return 127; | ||
} | ||
|
||
stdin_fd = open(argv[1], O_RDONLY); | ||
if (stdin_fd == -1) { | ||
fprintf(stderr, "open: %s: %s\n", argv[1], strerror(errno)); | ||
return 127; | ||
// Because we want to be able to read in both file descirptors and | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. typo: descirptors |
||
// files for stdin, we use a '#' to denote a file descriptor. | ||
const char* stdin_file = argv[1]; | ||
if (stdin_file[0] == '#') { | ||
stdin_fd = atoi(stdin_file + 1); | ||
} else { | ||
stdin_fd = open(stdin_file, O_RDONLY); | ||
if (stdin_fd == -1) { | ||
fprintf(stderr, "open: %s: %s\n", argv[1], strerror(errno)); | ||
return 127; | ||
Comment on lines
+157
to
+159
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please move this There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. atoi does not tell you if it fails so we can't catch the error :( There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I just meant something like
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. But that's incorrect for the atoi case. The dup/dup2 below will fail if something is wrong with |
||
} | ||
} | ||
|
||
stdout_fd = atoi(argv[2]); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not going to block, but I really think this should be explicit via a
tupledata in wakelang.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you mean exactly?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mentioned in chat but something like