Skip to content

Commit ac43e1e

Browse files
authored
Merge pull request #231 from supabase/output-to-stdout
fix: write bundle output to stdout
2 parents c71170a + 1cdcc07 commit ac43e1e

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

crates/cli/src/main.rs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -169,8 +169,15 @@ fn main() -> Result<(), anyhow::Error> {
169169
.await?;
170170
let bin = eszip.into_bytes();
171171

172-
let mut file = File::create(output_path.as_str()).unwrap();
173-
file.write_all(&bin).unwrap();
172+
if output_path == "-" {
173+
let stdout = std::io::stdout();
174+
let mut handle = stdout.lock();
175+
176+
handle.write_all(&bin)?
177+
} else {
178+
let mut file = File::create(output_path.as_str())?;
179+
file.write_all(&bin)?
180+
}
174181
}
175182
Some(("unbundle", sub_matches)) => {
176183
let output_path = sub_matches.get_one::<String>("output").cloned().unwrap();

0 commit comments

Comments
 (0)