Skip to content

Commit 3109353

Browse files
authored
Merge pull request #40 from stackql/feature/updates
download and server fixes for mac and windows
2 parents 2089881 + 488e986 commit 3109353

4 files changed

Lines changed: 27 additions & 32 deletions

File tree

.github/workflows/ci.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,13 +183,16 @@ jobs:
183183
- os: ubuntu-latest
184184
artifact-name: stackql-deploy-linux-x86_64
185185
archive: tar.gz
186+
- os: ubuntu-24.04-arm
187+
artifact-name: stackql-deploy-linux-arm64
188+
archive: tar.gz
186189
- os: windows-latest
187190
artifact-name: stackql-deploy-windows-x86_64
188191
archive: zip
189192
- os: macos-latest
190193
artifact-name: stackql-deploy-macos-arm64
191194
archive: tar.gz
192-
- os: macos-13
195+
- os: macos-26-intel
193196
artifact-name: stackql-deploy-macos-x86_64
194197
archive: tar.gz
195198
runs-on: ${{ matrix.os }}

.github/workflows/release.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,13 +143,16 @@ jobs:
143143
- os: ubuntu-latest
144144
artifact-name: stackql-deploy-linux-x86_64
145145
archive: tar.gz
146+
- os: ubuntu-24.04-arm
147+
artifact-name: stackql-deploy-linux-arm64
148+
archive: tar.gz
146149
- os: windows-latest
147150
artifact-name: stackql-deploy-windows-x86_64
148151
archive: zip
149152
- os: macos-latest
150153
artifact-name: stackql-deploy-macos-arm64
151154
archive: tar.gz
152-
- os: macos-13
155+
- os: macos-26-intel
153156
artifact-name: stackql-deploy-macos-x86_64
154157
archive: tar.gz
155158
runs-on: ${{ matrix.os }}

src/utils/download.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,11 +152,11 @@ fn extract_binary(
152152
match get_platform() {
153153
Platform::MacOS => {
154154
// For macOS, we need to use pkgutil
155+
// pkgutil --expand-full requires the destination directory to NOT exist
155156
let unpacked_dir = dest_dir.join("stackql_unpacked");
156157
if unpacked_dir.exists() {
157158
fs::remove_dir_all(&unpacked_dir).map_err(AppError::IoError)?;
158159
}
159-
fs::create_dir_all(&unpacked_dir).map_err(AppError::IoError)?;
160160

161161
let output = Command::new("pkgutil")
162162
.arg("--expand-full")

src/utils/server.rs

Lines changed: 18 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -93,48 +93,37 @@ pub fn find_all_running_servers() -> Vec<RunningServer> {
9393
let mut running_servers = Vec::new();
9494

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

108105
if let Ok(output) = output {
109106
let output_str = String::from_utf8_lossy(&output.stdout);
110-
let mut current_cmdline = String::new();
111-
let mut current_pid: Option<u32> = None;
112-
113107
for line in output_str.lines() {
114108
let line = line.trim();
115-
if let Some(cmdline) = line.strip_prefix("CommandLine=") {
116-
current_cmdline = cmdline.to_string();
117-
} else if let Some(pid_str) = line.strip_prefix("ProcessId=") {
118-
current_pid = pid_str.trim().parse().ok();
119-
}
120-
121-
// When we have both values, emit a server entry
122-
if let Some(pid) = current_pid {
123-
if !current_cmdline.is_empty() {
124-
if let Some(port) = extract_port_from_cmdline(&current_cmdline) {
125-
debug!(
126-
"find_all_running_servers (Windows): PID {} -> port {} (cmdline: {})",
127-
pid, port, current_cmdline
128-
);
129-
running_servers.push(RunningServer { pid, port });
109+
if let Some(rest) = line.strip_prefix("PID=") {
110+
if let Some(space_pos) = rest.find(" CMD=") {
111+
let pid_str = &rest[..space_pos];
112+
let cmdline = &rest[space_pos + 5..];
113+
if let Ok(pid) = pid_str.parse::<u32>() {
114+
if let Some(port) = extract_port_from_cmdline(cmdline) {
115+
debug!(
116+
"find_all_running_servers (Windows): PID {} -> port {}",
117+
pid, port
118+
);
119+
running_servers.push(RunningServer { pid, port });
120+
}
130121
}
131-
current_cmdline.clear();
132-
current_pid = None;
133122
}
134123
}
135124
}
136125
} else {
137-
debug!("find_all_running_servers: wmic command failed, falling back to tasklist");
126+
debug!("find_all_running_servers: PowerShell command failed");
138127
}
139128
} else {
140129
let output = ProcessCommand::new("pgrep")

0 commit comments

Comments
 (0)