Skip to content

Commit 9aa4eba

Browse files
committed
HOTFIX: allow file output to stdout
1 parent 5cf5bfd commit 9aa4eba

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

cobalt-cli/src/main.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -417,7 +417,7 @@ fn driver() -> anyhow::Result<()> {
417417
inkwell::targets::RelocMode::PIC,
418418
inkwell::targets::CodeModel::Small
419419
).expect("failed to create target machine");
420-
let output = (input != "-").then(|| output.map(String::from).unwrap_or_else(|| match emit {
420+
let mut output = output.map(String::from).or_else(|| (input != "-").then(|| match emit {
421421
OutputType::Executable => format!("{}{}", input.rfind('.').map_or(input.as_str(), |i| &input[..i]), if triple.contains("windows") {".exe"} else {""}),
422422
OutputType::Library => libs::format_lib(input.rfind('.').map_or(input.as_str(), |i| &input[..i]), &trip),
423423
OutputType::Object => format!("{}.o", input.rfind('.').map_or(input.as_str(), |i| &input[..i])),
@@ -427,6 +427,7 @@ fn driver() -> anyhow::Result<()> {
427427
OutputType::Header => format!("{}.coh", input.rfind('.').map_or(input.as_str(), |i| &input[..i])),
428428
OutputType::HeaderObj => format!("{}.coh.o", input.rfind('.').map_or(input.as_str(), |i| &input[..i])),
429429
}));
430+
output = output.and_then(|v| (v != "-").then_some(v));
430431
let mut flags = Flags {dbg_mangle: debug_mangle, ..Flags::default()};
431432
let ink_ctx = inkwell::context::Context::create();
432433
if let Some(size) = ink_ctx.ptr_sized_int_type(&target_machine.get_target_data(), None).size_of().get_zero_extended_constant() {flags.word_size = size as u16;}

0 commit comments

Comments
 (0)