Skip to content
Merged
Show file tree
Hide file tree
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
5 changes: 4 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -183,13 +183,16 @@ jobs:
- os: ubuntu-latest
artifact-name: stackql-deploy-linux-x86_64
archive: tar.gz
- os: ubuntu-24.04-arm
artifact-name: stackql-deploy-linux-arm64
archive: tar.gz
- os: windows-latest
artifact-name: stackql-deploy-windows-x86_64
archive: zip
- os: macos-latest
artifact-name: stackql-deploy-macos-arm64
archive: tar.gz
- os: macos-13
- os: macos-26-intel
artifact-name: stackql-deploy-macos-x86_64
archive: tar.gz
runs-on: ${{ matrix.os }}
Expand Down
5 changes: 4 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -143,13 +143,16 @@ jobs:
- os: ubuntu-latest
artifact-name: stackql-deploy-linux-x86_64
archive: tar.gz
- os: ubuntu-24.04-arm
artifact-name: stackql-deploy-linux-arm64
archive: tar.gz
- os: windows-latest
artifact-name: stackql-deploy-windows-x86_64
archive: zip
- os: macos-latest
artifact-name: stackql-deploy-macos-arm64
archive: tar.gz
- os: macos-13
- os: macos-26-intel
artifact-name: stackql-deploy-macos-x86_64
archive: tar.gz
runs-on: ${{ matrix.os }}
Expand Down
2 changes: 1 addition & 1 deletion src/utils/download.rs
Original file line number Diff line number Diff line change
Expand Up @@ -152,11 +152,11 @@ fn extract_binary(
match get_platform() {
Platform::MacOS => {
// For macOS, we need to use pkgutil
// pkgutil --expand-full requires the destination directory to NOT exist
let unpacked_dir = dest_dir.join("stackql_unpacked");
if unpacked_dir.exists() {
fs::remove_dir_all(&unpacked_dir).map_err(AppError::IoError)?;
}
fs::create_dir_all(&unpacked_dir).map_err(AppError::IoError)?;

let output = Command::new("pkgutil")
.arg("--expand-full")
Expand Down
47 changes: 18 additions & 29 deletions src/utils/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,48 +93,37 @@ pub fn find_all_running_servers() -> Vec<RunningServer> {
let mut running_servers = Vec::new();

if cfg!(target_os = "windows") {
// Use WMIC to get stackql processes with their command lines and PIDs
let output = ProcessCommand::new("wmic")
// Use PowerShell Get-CimInstance to get stackql processes with command lines
let output = ProcessCommand::new("powershell")
.args([
"process",
"where",
"name='stackql.exe'",
"get",
"ProcessId,CommandLine",
"/format:list",
"-NoProfile",
"-Command",
"Get-CimInstance Win32_Process -Filter \"Name='stackql.exe'\" | ForEach-Object { \"PID=$($_.ProcessId) CMD=$($_.CommandLine)\" }",
])
.output();

if let Ok(output) = output {
let output_str = String::from_utf8_lossy(&output.stdout);
let mut current_cmdline = String::new();
let mut current_pid: Option<u32> = None;

for line in output_str.lines() {
let line = line.trim();
if let Some(cmdline) = line.strip_prefix("CommandLine=") {
current_cmdline = cmdline.to_string();
} else if let Some(pid_str) = line.strip_prefix("ProcessId=") {
current_pid = pid_str.trim().parse().ok();
}

// When we have both values, emit a server entry
if let Some(pid) = current_pid {
if !current_cmdline.is_empty() {
if let Some(port) = extract_port_from_cmdline(&current_cmdline) {
debug!(
"find_all_running_servers (Windows): PID {} -> port {} (cmdline: {})",
pid, port, current_cmdline
);
running_servers.push(RunningServer { pid, port });
if let Some(rest) = line.strip_prefix("PID=") {
if let Some(space_pos) = rest.find(" CMD=") {
let pid_str = &rest[..space_pos];
let cmdline = &rest[space_pos + 5..];
if let Ok(pid) = pid_str.parse::<u32>() {
if let Some(port) = extract_port_from_cmdline(cmdline) {
debug!(
"find_all_running_servers (Windows): PID {} -> port {}",
pid, port
);
running_servers.push(RunningServer { pid, port });
}
}
current_cmdline.clear();
current_pid = None;
}
}
}
} else {
debug!("find_all_running_servers: wmic command failed, falling back to tasklist");
debug!("find_all_running_servers: PowerShell command failed");
}
} else {
let output = ProcessCommand::new("pgrep")
Expand Down
Loading