mirror of
https://github.com/erg-lang/erg.git
synced 2025-09-30 04:44:44 +00:00
Changed String::from_utf8 to String::from_utf8_lossy
This commit is contained in:
parent
6921189a95
commit
667b905e36
3 changed files with 3 additions and 4 deletions
|
@ -8,7 +8,7 @@ fn main() -> std::io::Result<()> {
|
||||||
.args(&["rev-parse", "--short", "HEAD"])
|
.args(&["rev-parse", "--short", "HEAD"])
|
||||||
.output()
|
.output()
|
||||||
.expect("failed to get the git hash");
|
.expect("failed to get the git hash");
|
||||||
let git_hash_short = String::from_utf8(output.stdout).unwrap();
|
let git_hash_short = String::from_utf8_lossy(&output.stdout);
|
||||||
let now = datetime::now();
|
let now = datetime::now();
|
||||||
println!("cargo:rustc-env=GIT_HASH_SHORT={git_hash_short}");
|
println!("cargo:rustc-env=GIT_HASH_SHORT={git_hash_short}");
|
||||||
println!("cargo:rustc-env=BUILD_DATE={now}");
|
println!("cargo:rustc-env=BUILD_DATE={now}");
|
||||||
|
|
|
@ -13,8 +13,7 @@ pub fn now() -> String {
|
||||||
.output()
|
.output()
|
||||||
.expect("failed to execute process to get current time")
|
.expect("failed to execute process to get current time")
|
||||||
};
|
};
|
||||||
String::from_utf8(output.stdout.clone())
|
String::from_utf8_lossy(&output.stdout[..])
|
||||||
.unwrap_or_else(|_| String::from_utf8_lossy(&output.stdout[..]).to_string())
|
|
||||||
.trim_end()
|
.trim_end()
|
||||||
.to_string()
|
.to_string()
|
||||||
}
|
}
|
||||||
|
|
|
@ -87,7 +87,7 @@ pub fn eval_pyc<S: Into<String>>(file: S) -> String {
|
||||||
.expect("cannot execute python")
|
.expect("cannot execute python")
|
||||||
};
|
};
|
||||||
let out = out.wait_with_output().expect("python doesn't work");
|
let out = out.wait_with_output().expect("python doesn't work");
|
||||||
String::from_utf8(out.stdout).expect("failed to decode python output")
|
String::from_utf8_lossy(&out.stdout).to_string()
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn exec_py(code: &str) {
|
pub fn exec_py(code: &str) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue