mirror of
https://github.com/denoland/deno.git
synced 2024-12-22 07:14:47 -05:00
chore: remove println in DenoCompileBinaryWriter (#19976)
This commit is contained in:
parent
0ec4feaee7
commit
cfdef0c380
2 changed files with 17 additions and 14 deletions
|
@ -68,6 +68,15 @@ pub struct CompileFlags {
|
||||||
pub include: Vec<String>,
|
pub include: Vec<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl CompileFlags {
|
||||||
|
pub fn resolve_target(&self) -> String {
|
||||||
|
self
|
||||||
|
.target
|
||||||
|
.clone()
|
||||||
|
.unwrap_or_else(|| env!("TARGET").to_string())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug, Eq, PartialEq)]
|
#[derive(Clone, Debug, Eq, PartialEq)]
|
||||||
pub struct CompletionsFlags {
|
pub struct CompletionsFlags {
|
||||||
pub buf: Box<[u8]>,
|
pub buf: Box<[u8]>,
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
|
// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
|
||||||
|
|
||||||
use std::collections::BTreeMap;
|
use std::collections::BTreeMap;
|
||||||
use std::env::consts;
|
|
||||||
use std::env::current_exe;
|
use std::env::current_exe;
|
||||||
use std::io::Read;
|
use std::io::Read;
|
||||||
use std::io::Seek;
|
use std::io::Seek;
|
||||||
|
@ -385,19 +384,14 @@ impl<'a> DenoCompileBinaryWriter<'a> {
|
||||||
cli_options: &CliOptions,
|
cli_options: &CliOptions,
|
||||||
) -> Result<(), AnyError> {
|
) -> Result<(), AnyError> {
|
||||||
// Select base binary based on target
|
// Select base binary based on target
|
||||||
let mut original_binary =
|
let mut original_binary = self.get_base_binary(compile_flags).await?;
|
||||||
self.get_base_binary(compile_flags.target.clone()).await?;
|
|
||||||
|
|
||||||
let target = compile_flags
|
|
||||||
.target
|
|
||||||
.clone()
|
|
||||||
.unwrap_or(consts::OS.to_string());
|
|
||||||
|
|
||||||
if compile_flags.no_terminal {
|
if compile_flags.no_terminal {
|
||||||
if target != "x86_64-pc-windows-msvc" && target != "windows" {
|
let target = compile_flags.resolve_target();
|
||||||
println!("{}", target);
|
if !target.contains("windows") {
|
||||||
bail!(
|
bail!(
|
||||||
"The `--no-terminal` flag is only available when targeting Windows"
|
"The `--no-terminal` flag is only available when targeting Windows (current: {})",
|
||||||
|
target,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
set_windows_binary_to_gui(&mut original_binary)?;
|
set_windows_binary_to_gui(&mut original_binary)?;
|
||||||
|
@ -417,14 +411,14 @@ impl<'a> DenoCompileBinaryWriter<'a> {
|
||||||
|
|
||||||
async fn get_base_binary(
|
async fn get_base_binary(
|
||||||
&self,
|
&self,
|
||||||
target: Option<String>,
|
compile_flags: &CompileFlags,
|
||||||
) -> Result<Vec<u8>, AnyError> {
|
) -> Result<Vec<u8>, AnyError> {
|
||||||
if target.is_none() {
|
if compile_flags.target.is_none() {
|
||||||
let path = std::env::current_exe()?;
|
let path = std::env::current_exe()?;
|
||||||
return Ok(std::fs::read(path)?);
|
return Ok(std::fs::read(path)?);
|
||||||
}
|
}
|
||||||
|
|
||||||
let target = target.unwrap_or_else(|| env!("TARGET").to_string());
|
let target = compile_flags.resolve_target();
|
||||||
let binary_name = format!("deno-{target}.zip");
|
let binary_name = format!("deno-{target}.zip");
|
||||||
|
|
||||||
let binary_path_suffix = if crate::version::is_canary() {
|
let binary_path_suffix = if crate::version::is_canary() {
|
||||||
|
|
Loading…
Reference in a new issue