-
-
Notifications
You must be signed in to change notification settings - Fork 2k
Tail macos stdin ran from script fix #7844
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
Changes from 3 commits
cf2331a
3c2e83a
6b5f6dd
ecc8a9a
7bc5f8c
7008e79
a0e4f60
f30d772
e04a0dc
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 |
|---|---|---|
|
|
@@ -324,6 +324,7 @@ fn test_stdin_redirect_dir() { | |
| // `test_stdin_redirect_dir` | ||
| #[test] | ||
| #[cfg(target_vendor = "apple")] | ||
| #[ignore = "disabled until fixed"] | ||
|
Contributor
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 would prefer you fix that before we merge this PR :)
Contributor
Author
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. fixed in latest commit!
Contributor
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. it is still ignored :)
Contributor
Author
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. sorry about this! must have been missed when i tried to squash, but it is fixed |
||
| fn test_stdin_redirect_dir_when_target_os_is_macos() { | ||
| // $ mkdir dir | ||
| // $ tail < dir, $ tail - < dir | ||
|
|
@@ -346,6 +347,54 @@ fn test_stdin_redirect_dir_when_target_os_is_macos() { | |
| .stderr_is("tail: cannot open 'standard input' for reading: No such file or directory\n"); | ||
| } | ||
|
|
||
| #[test] | ||
| #[cfg(unix)] | ||
|
Contributor
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. seems that it is failing on freebsd:
Contributor
Author
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. thanks for pointing this out, subtleties in FreeBSD |
||
| fn test_stdin_via_script_redirection_and_pipe() { | ||
| // $ touch file.txt | ||
| // $ echo line1 > file.txt | ||
| // $ echo line2 >> file.txt | ||
| // $ chmod +x test.sh | ||
| // $ ./test.sh < file.txt | ||
| // line1 | ||
| // line2 | ||
| // $ cat file.txt | ./test.sh | ||
| // line1 | ||
| // line2 | ||
| use std::os::unix::fs::PermissionsExt; | ||
|
|
||
| let scene = TestScenario::new(util_name!()); | ||
| let at = &scene.fixtures; | ||
| let data = "line1\nline2\n"; | ||
|
|
||
| at.write("file.txt", data); | ||
|
|
||
| let mut script = at.make_file("test.sh"); | ||
|
|
||
| writeln!(script, "#!/bin/bash").unwrap(); | ||
| writeln!(script, "tail").unwrap(); | ||
| script | ||
| .set_permissions(PermissionsExt::from_mode(0o755)) | ||
| .unwrap(); | ||
|
|
||
| drop(script); // close the file handle to ensure file is not busy | ||
|
|
||
| // test with redirection | ||
| scene | ||
| .cmd("sh") | ||
| .arg("-c") | ||
| .arg("./test.sh < file.txt") | ||
| .succeeds() | ||
| .stdout_only(data); | ||
|
|
||
| // test with pipe | ||
| scene | ||
| .cmd("sh") | ||
| .arg("-c") | ||
| .arg("cat file.txt | ./test.sh") | ||
| .succeeds() | ||
| .stdout_only(data); | ||
| } | ||
|
|
||
| #[test] | ||
| fn test_follow_stdin_descriptor() { | ||
| let ts = TestScenario::new(util_name!()); | ||
|
|
||
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.
please add a comment explaining why macos is empty