more flexible for --get-id

This commit is contained in:
rustdesk 2023-07-27 10:46:48 +08:00
parent 8f851bc781
commit 9967bb993f
3 changed files with 18 additions and 4 deletions

View File

@ -102,7 +102,7 @@ pub fn core_main() -> Option<Vec<String>> {
}
if args.len() > 0 && args[0] == "--version" {
// not use my_println here, because check super use using this command, no dialog expected
println!("{}", crate::VERSION);
my_println!("{}", crate::VERSION);
return None;
}
#[cfg(windows)]

View File

@ -1,5 +1,5 @@
#![cfg_attr(
all(not(debug_assertions), target_os = "windows"),
all(target_os = "windows"),
windows_subsystem = "windows"
)]

View File

@ -2301,16 +2301,30 @@ mod tests {
pub fn message_box(text: &str) {
let mut text = text.to_owned();
if !text.ends_with("!") {
let nodialog = std::env::var("NO_DIALOG").unwrap_or_default() == "Y";
if !text.ends_with("!") || nodialog {
use arboard::Clipboard as ClipboardContext;
match ClipboardContext::new() {
Ok(mut ctx) => {
ctx.set_text(&text).ok();
text = format!("{}\n\nAbove text has been copied to clipboard", &text);
if !nodialog {
text = format!("{}\n\nAbove text has been copied to clipboard", &text);
}
}
_ => {}
}
}
if nodialog {
if std::env::var("PRINT_OUT").unwrap_or_default() == "Y" {
println!("{text}");
}
if let Ok(x) = std::env::var("WRITE_TO_FILE") {
if !x.is_empty() {
allow_err!(std::fs::write(x, text));
}
}
return;
}
let text = text
.encode_utf16()
.chain(std::iter::once(0))