#2874 on steroids Before you mark this PR as ready for review, make sure that you have: - [ ] Added a solid test coverage and/or screenshots from doing manual testing - [ ] Done a self-review taking into account security and performance aspects - [ ] Aligned any UI changes with the [UI checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist) Release Notes: - N/A --------- Co-authored-by: Eric Holk <eric@zed.dev>
35 lines
1.2 KiB
Rust
35 lines
1.2 KiB
Rust
use fs::Fs;
|
|
use gpui::AppContext;
|
|
use gpui_platform::headless;
|
|
|
|
fn main() {
|
|
let Some(path_to_read) = std::env::args().nth(1) else {
|
|
println!("Expected path to read as 1st argument.");
|
|
return;
|
|
};
|
|
|
|
let _ = headless().run(|cx| {
|
|
let fs = fs::RealFs::new(None, cx.background_executor().clone());
|
|
cx.background_spawn(async move {
|
|
let timer = std::time::Instant::now();
|
|
let result = fs.load_bytes(path_to_read.as_ref()).await;
|
|
let elapsed = timer.elapsed();
|
|
if let Err(e) = result {
|
|
println!("Failed `load_bytes` after {elapsed:?} with error `{e}`");
|
|
} else {
|
|
println!("Took {elapsed:?} to read {} bytes", result.unwrap().len());
|
|
};
|
|
let timer = std::time::Instant::now();
|
|
let result = fs.metadata(path_to_read.as_ref()).await;
|
|
let elapsed = timer.elapsed();
|
|
if let Err(e) = result {
|
|
println!("Failed `metadata` after {elapsed:?} with error `{e}`");
|
|
} else {
|
|
println!("Took {elapsed:?} to query metadata");
|
|
};
|
|
std::process::exit(0);
|
|
})
|
|
.detach();
|
|
});
|
|
}
|