fix(windows): suppress background console windows
Some checks failed
Desktop Release / Bootstrap updater signing key (push) Has been cancelled
Desktop Release / Windows x64 NSIS (push) Has been cancelled
Desktop Release / Linux x64 DEB + AppImage (push) Has been cancelled
Desktop Release / Publish public desktop release (push) Has been cancelled
Some checks failed
Desktop Release / Bootstrap updater signing key (push) Has been cancelled
Desktop Release / Windows x64 NSIS (push) Has been cancelled
Desktop Release / Linux x64 DEB + AppImage (push) Has been cancelled
Desktop Release / Publish public desktop release (push) Has been cancelled
This commit is contained in:
parent
96939380b0
commit
8915fca840
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@fieldlens/print",
|
||||
"version": "0.1.23",
|
||||
"version": "0.1.24",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "fieldlens-print"
|
||||
version = "0.1.23"
|
||||
version = "0.1.24"
|
||||
description = "FieldLens print-stream barcode capture companion"
|
||||
authors = ["Arrowstack"]
|
||||
edition = "2021"
|
||||
|
||||
@ -11,6 +11,8 @@ use base64::{engine::general_purpose::STANDARD as BASE64_STANDARD, Engine as _};
|
||||
use parking_lot::Mutex;
|
||||
use serde_json::Value;
|
||||
use std::{fs, path::{Path, PathBuf}, time::SystemTime};
|
||||
#[cfg(target_os = "windows")]
|
||||
use std::os::windows::process::CommandExt;
|
||||
use tauri::{AppHandle, Manager, State};
|
||||
|
||||
use capture::CaptureRuntime;
|
||||
@ -158,7 +160,12 @@ fn build_self_test_pdf() -> Vec<u8> {
|
||||
|
||||
fn debug_command_check(name: &str) -> DebugCheck {
|
||||
#[cfg(target_os = "windows")]
|
||||
let result = std::process::Command::new("where").arg(name).output();
|
||||
let result = {
|
||||
const CREATE_NO_WINDOW: u32 = 0x08000000;
|
||||
let mut command = std::process::Command::new("where.exe");
|
||||
command.creation_flags(CREATE_NO_WINDOW);
|
||||
command.arg(name).output()
|
||||
};
|
||||
|
||||
#[cfg(not(target_os = "windows"))]
|
||||
let result = std::process::Command::new("sh")
|
||||
|
||||
@ -1,5 +1,8 @@
|
||||
use std::process::Command;
|
||||
|
||||
#[cfg(target_os = "windows")]
|
||||
use std::os::windows::process::CommandExt;
|
||||
|
||||
#[cfg(any(target_os = "windows", target_os = "linux"))]
|
||||
use std::fs;
|
||||
#[cfg(target_os = "linux")]
|
||||
@ -18,6 +21,15 @@ const TEST_VIRTUAL_PRINTER_QUEUE: &str = "FieldLens-Test-Capture";
|
||||
#[cfg(target_os = "linux")]
|
||||
const TEST_CAPTURE_DEVICE_URI: &str = "socket://127.0.0.1:9101";
|
||||
const WINDOWS_PORT_NAME: &str = "FieldLensPrint-9100";
|
||||
#[cfg(target_os = "windows")]
|
||||
const CREATE_NO_WINDOW: u32 = 0x08000000;
|
||||
|
||||
#[cfg(target_os = "windows")]
|
||||
fn hidden_windows_command(program: &str) -> Command {
|
||||
let mut command = Command::new(program);
|
||||
command.creation_flags(CREATE_NO_WINDOW);
|
||||
command
|
||||
}
|
||||
|
||||
#[cfg(target_os = "linux")]
|
||||
const FIELDLENS_CUPS_SPOOL_DIR: &str = "/var/lib/fieldlens-print/capture";
|
||||
@ -325,8 +337,8 @@ $items = @(
|
||||
$items | ConvertTo-Json -Compress
|
||||
"#;
|
||||
|
||||
let output = Command::new("powershell")
|
||||
.args(["-NoProfile", "-NonInteractive", "-Command", script])
|
||||
let output = hidden_windows_command("powershell.exe")
|
||||
.args(["-NoProfile", "-NonInteractive", "-WindowStyle", "Hidden", "-Command", script])
|
||||
.output()
|
||||
.context("query Windows printers")?;
|
||||
|
||||
@ -397,11 +409,11 @@ if ($null -ne $targetConfig -and $targetConfig.PrintTicketXML) {{
|
||||
|
||||
let path = ps_quote(&script_path.to_string_lossy());
|
||||
let elevated = format!(
|
||||
"$p = Start-Process powershell -Verb RunAs -Wait -PassThru -ArgumentList @('-NoProfile','-ExecutionPolicy','Bypass','-File','{path}','-TargetPrinter','{target}'); exit $p.ExitCode"
|
||||
"$p = Start-Process -FilePath powershell.exe -Verb RunAs -WindowStyle Hidden -Wait -PassThru -ArgumentList @('-NoProfile','-NonInteractive','-WindowStyle','Hidden','-ExecutionPolicy','Bypass','-File','{path}','-TargetPrinter','{target}'); exit $p.ExitCode"
|
||||
);
|
||||
|
||||
let status = Command::new("powershell")
|
||||
.args(["-NoProfile", "-Command", &elevated])
|
||||
let status = hidden_windows_command("powershell.exe")
|
||||
.args(["-NoProfile", "-NonInteractive", "-WindowStyle", "Hidden", "-Command", &elevated])
|
||||
.status()
|
||||
.context("launch elevated Windows printer setup")?;
|
||||
|
||||
@ -440,10 +452,10 @@ if (Get-PrinterPort -Name $portName -ErrorAction SilentlyContinue) {{
|
||||
fs::write(&script_path, script)?;
|
||||
let path = ps_quote(&script_path.to_string_lossy());
|
||||
let elevated = format!(
|
||||
"$p = Start-Process powershell -Verb RunAs -Wait -PassThru -ArgumentList @('-NoProfile','-ExecutionPolicy','Bypass','-File','{path}'); exit $p.ExitCode"
|
||||
"$p = Start-Process -FilePath powershell.exe -Verb RunAs -WindowStyle Hidden -Wait -PassThru -ArgumentList @('-NoProfile','-NonInteractive','-WindowStyle','Hidden','-ExecutionPolicy','Bypass','-File','{path}'); exit $p.ExitCode"
|
||||
);
|
||||
let status = Command::new("powershell")
|
||||
.args(["-NoProfile", "-Command", &elevated])
|
||||
let status = hidden_windows_command("powershell.exe")
|
||||
.args(["-NoProfile", "-NonInteractive", "-WindowStyle", "Hidden", "-Command", &elevated])
|
||||
.status()?;
|
||||
let _ = fs::remove_file(&script_path);
|
||||
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
{
|
||||
"$schema": "https://schema.tauri.app/config/2",
|
||||
"productName": "FieldLens Print",
|
||||
"version": "0.1.23",
|
||||
"version": "0.1.24",
|
||||
"identifier": "dev.arrowstack.fieldlens.print",
|
||||
"build": {
|
||||
"beforeDevCommand": "npm run dev",
|
||||
|
||||
@ -142,7 +142,7 @@ let config: AppConfig
|
||||
let jobs: Job[] = []
|
||||
let status: Status = { running: false, mode: 'raw-proxy', pending: 0, jobs: 0 }
|
||||
let loginTimer: number | undefined
|
||||
let currentVersion = '0.1.23'
|
||||
let currentVersion = '0.1.24'
|
||||
let bundleType: BundleType | null = null
|
||||
let availableUpdate: Update | null = null
|
||||
let availableManualUpdate: ManualUpdate | null = null
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user