Skip to content
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

Ignores '@' returned from interpolation evaluation #636

Merged
merged 1 commit into from
Jun 9, 2020

Conversation

rjsberry
Copy link
Contributor

@rjsberry rjsberry commented Jun 9, 2020

Just now interprets this literally rather than propagating it to make the line run quietly.

@rjsberry rjsberry force-pushed the bugfix-quiet-interpolation-evaluation branch 2 times, most recently from 58e7b13 to 55070ce Compare June 9, 2020 18:43
Copy link
Owner

@casey casey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! Just one issue with an edge case.

src/recipe.rs Outdated
loop {
if lines.peek().is_none() {
break;
}
let line = lines.next().unwrap();
line_number += 1;
if evaluated.is_empty() {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will return true if we're on the second line, but the first line didn't evaluate to any text, for example:

foo:
  {{""}}\
  @echo foo 2>/dev/null

In practice, I don't think anyone is likely to hit this, but it would be nice to add a test for it and only mark lines as quiet if the leading @ is on the first line.

I think this can be avoided by moving the check for a quiet command outside the loop, like so:

let quiet_command = lines.next().map(|line| line.is_quiet()).unwrap_or(false);

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice catch.

Just now interprets this literally rather than propagating it to make
the line run quietly.
@rjsberry rjsberry force-pushed the bugfix-quiet-interpolation-evaluation branch from 55070ce to 7247885 Compare June 9, 2020 22:05
@casey casey merged commit 89ee052 into casey:master Jun 9, 2020
@casey
Copy link
Owner

casey commented Jun 9, 2020

Merged, thank you very much!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants