-
Notifications
You must be signed in to change notification settings - Fork 19
echo "42" #15
Comments
Hm, |
I suspect this happens on the expansion side, since The question is how Btw. I just double-checked the behaviour of bash-
.. oh dear, I love bash. (not really). LOL. |
POSIX shell syntax is basically a lisp where everything is a string. 😅 So, But, we are not in a shell here! Rust's So, for us, there is a difference between |
Hm. Ok I didn't know much about LISP but now I don't want to learn it either. ^^ Regarding the initial "problem" I think it can be solved via documenting the status quo. That is This means however that the |
I made a comment in a commit. That was probably not my best idea today.. ^^ |
TL;DR: Ok, we can detect if the stringified output is delimited by That should be the same as to deserialize a string, like in JSON, right? Ok, now phrased that way it sounds solvable. These crates should be able to handle that job: I haven't used any of these, but extern crate rustc_serialize;
use rustc_serialize::json::Json;
fn main() {
let x = stringify!("foo");
if let Ok(Json::String(y)) = Json::from_str(x) {
println!("x={:?}, y={:?}", x, y);
// ^--> x="\"foo\"", y="foo"
}
} PS:
|
when I run
echo "42"
on my shell it prints42
, just asecho 42
does.However
Assert::command(&["echo", "\"42\""])
behaves identical.I would have naively expected the behaviour from my shell. But I don't know how other shell APIs behave. Is there any particular reason for the current behaviour?
PS: I'll get to the code too .. I'm just familiarizing myself with this crate first. :-)
The text was updated successfully, but these errors were encountered: