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

[BUG] Bad escaping for a string with \$ sequence #593 #594

Open
wants to merge 1 commit into
base: staging
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/modules/expression/literal/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,9 @@ fn translate_escaped_string(string: String, is_str: bool) -> String {
chars.next();
},
Some('$') => {
if is_str {
result.push('\\');
}
result.push('$');
chars.next();
},
Expand Down
4 changes: 2 additions & 2 deletions src/std/env.ab
Original file line number Diff line number Diff line change
Expand Up @@ -65,16 +65,16 @@ pub fun is_command(command: Text): Bool {
/// Creates a prompt and returns the value.
pub fun input(prompt: Text): Text {
trust $ read -p "\${nameof prompt}" $
return "\$REPLY"
return trust $ echo \$REPLY $
}

/// Creates a prompt, hides any user input and returns the value.
pub fun input_hidden(prompt: Text): Text {
trust {
$ read -s -p "\${nameof prompt}" $
$ echo "" >&2 $
return $ echo \$REPLY $
}
return "\$REPLY"
}

/// Creates a confirm prompt (Yes/No), and returns true if the choice is Yes.
Expand Down
Loading