-
-
Notifications
You must be signed in to change notification settings - Fork 676
Fix issue18076: allow -run to work with - (stdin) #7435
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 all commits
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 |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| #!/usr/bin/env bash | ||
|
|
||
| dir=${RESULTS_DIR}${SEP}runnable | ||
| output_file=${dir}/test18076.sh.out | ||
|
|
||
| echo 'import std.stdio; void main() { writeln("Success"); }' | \ | ||
| $DMD -m${MODEL} -run - > ${output_file} || exit 1 | ||
|
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. Don't you have to check that it actually prints "Success" here?
Member
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. You're right, fixed. |
||
| grep -q '^Success$' ${output_file} || exit 1 | ||
|
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. FWIW the sh -c "grep -q 'foo' afile.d" ; echo $?
Member
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. True. I'm wary of relying on these implicit behaviours, though. Stating
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. That's why one usually does a |
||
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.
This is too simplistic, it won't work if there's a command after
-run, e.g.dmd -run -m64 -Uh oh!
There was an error while loading. Please reload this page.
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.
Actually,
-runtakes an argument, so your example is invalid. (I'm not sure why whoever originally implemented-rundid it this way, but that's how it currently works, and this PR is just following in its steps.)(And yes, the first time I realized-runtook an argument I was surprised too. :-P)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.
Oh sorry. I just looked over this again from my phone and imagined that doing
dmd -run -version=Foo myfile.dis legimate, so yeah that seems like bad design too me too, but that's an opportunity for another PR ;-)