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

Delegate writing mbti files to mooninfo instead of capturing stdout #565

Merged
merged 1 commit into from
Jan 16, 2025
Merged
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
19 changes: 9 additions & 10 deletions crates/moon/src/cli/info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -247,8 +247,14 @@ pub fn run_info_internal(
if !mi.exists() {
bail!("cannot find mi file for package {}", name);
}

let mut args = vec!["-format=text".into(), mi.display().to_string()];
let filepath = mi.with_extension("mbti");
let filename = filepath.file_name().unwrap().to_str().unwrap();

let mut args = vec![
"-format=text".into(),
mi.display().to_string(),
format!("-o={}", filepath.display()),
];
if cmd.no_alias {
args.push("-no-alias".into());
}
Expand All @@ -257,13 +263,6 @@ pub fn run_info_internal(
let out = mooninfo.output().await?;

if out.status.success() {
let filename = format!("{}.mbti", pkg.last_name());
let filepath = mi.with_extension("mbti");

tokio::fs::write(&filepath, out.stdout)
.await
.context(format!("failed to write {}", filename))?;

if
// no target specified, default to wasmgc
cmd.target.is_none()
Expand All @@ -277,7 +276,7 @@ pub fn run_info_internal(
&filepath,
&module_source_dir
.join(pkg.rel.fs_full_name())
.join(&filename),
.join(filename),
)
.await?;
}
Expand Down
Loading