Skip to content

Commit c0eaf9d

Browse files
Fix Linux debug builds: use production deps path, improve signal reporting
- dependency_locator: Skip upward deps/ search on Linux since deps are always installed to ~/.local/share/VapourBox/deps/. The upward search was matching macOS deps/ and generating invalid env vars. Keep the old behaviour for macOS/Windows debug builds. - pipeline_executor: Report actual signal name (e.g. SIGSEGV) instead of opaque exit code -1 when a process is killed by a signal. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent bdde972 commit c0eaf9d

2 files changed

Lines changed: 38 additions & 11 deletions

File tree

worker/src/dependency_locator.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,13 @@ impl DependencyLocator {
3333
}
3434

3535
/// Find the deps directory by searching various locations.
36-
fn find_deps_directory(exe_path: &Path) -> Result<PathBuf> {
37-
// Development only: search upward from executable for project deps.
36+
fn find_deps_directory(#[allow(unused)] exe_path: &Path) -> Result<PathBuf> {
37+
// Development only (macOS/Windows): search upward from executable for project deps.
3838
// This is restricted to debug builds for security - release builds
3939
// should only check known production paths.
40-
#[cfg(debug_assertions)]
40+
// Linux always uses the production path since deps are built/downloaded
41+
// separately and installed to ~/.local/share/VapourBox/deps/.
42+
#[cfg(all(debug_assertions, not(target_os = "linux")))]
4143
{
4244
let mut current = exe_path.parent();
4345
while let Some(dir) = current {
@@ -47,9 +49,7 @@ impl DependencyLocator {
4749
// to distinguish from Cargo's deps folder.
4850
let has_platform_dir = deps_dir.join("windows-x64").exists()
4951
|| deps_dir.join("macos-arm64").exists()
50-
|| deps_dir.join("macos-x64").exists()
51-
|| deps_dir.join("linux-x64").exists()
52-
|| deps_dir.join("linux-arm64").exists();
52+
|| deps_dir.join("macos-x64").exists();
5353
if has_platform_dir {
5454
return Ok(deps_dir);
5555
}

worker/src/pipeline_executor.rs

Lines changed: 32 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,35 @@ use std::sync::Arc;
99
use std::thread;
1010
use std::time::Duration;
1111

12+
#[cfg(unix)]
13+
use std::os::unix::process::ExitStatusExt;
14+
1215
use anyhow::{bail, Context, Result};
1316

17+
/// Format an exit status for error messages, including signal info on Unix.
18+
fn format_exit_status(status: &std::process::ExitStatus) -> String {
19+
if let Some(code) = status.code() {
20+
return format!("exit code {}", code);
21+
}
22+
#[cfg(unix)]
23+
{
24+
if let Some(sig) = status.signal() {
25+
let name = match sig {
26+
1 => "SIGHUP",
27+
2 => "SIGINT",
28+
6 => "SIGABRT",
29+
9 => "SIGKILL",
30+
11 => "SIGSEGV",
31+
13 => "SIGPIPE",
32+
15 => "SIGTERM",
33+
_ => "unknown",
34+
};
35+
return format!("signal {} ({})", sig, name);
36+
}
37+
}
38+
"unknown status".to_string()
39+
}
40+
1441
use crate::dependency_locator::DependencyLocator;
1542
use crate::models::{AudioMode, ContainerFormat, DeinterlaceMethod, EncoderFamily, EncodingSettings, LogLevel, ProgressInfo, SubtitleOutput, VideoCodec, VideoJob};
1643
use crate::progress_reporter::ProgressReporter;
@@ -370,21 +397,21 @@ impl PipelineExecutor {
370397
if let Some(status) = decoder_status {
371398
let code = status.code().unwrap_or(-1);
372399
if code != 0 && code != 130 && code != 141 && code != 224 {
373-
bail!("Decoder ffmpeg exited with code {}", code);
400+
bail!("Decoder ffmpeg exited with {}", format_exit_status(&status));
374401
}
375402
}
376403

377404
if let Some(status) = vspipe_status {
378405
let code = status.code().unwrap_or(-1);
379406
if code != 0 && code != 130 && code != 141 {
380-
bail!("vspipe exited with code {}", code);
407+
bail!("vspipe exited with {}", format_exit_status(&status));
381408
}
382409
}
383410

384411
let ffmpeg_ok = if let Some(status) = ffmpeg_status {
385412
let code = status.code().unwrap_or(-1);
386413
if code != 0 && code != 130 && code != 141 {
387-
bail!("ffmpeg exited with code {}", code);
414+
bail!("ffmpeg exited with {}", format_exit_status(&status));
388415
}
389416
true
390417
} else {
@@ -790,11 +817,11 @@ impl PipelineExecutor {
790817
if !errors.is_empty() {
791818
bail!("vspipe failed: {}", errors.join("\n"));
792819
}
793-
bail!("vspipe exited with code {}", vspipe_status.code().unwrap_or(-1));
820+
bail!("vspipe exited with {}", format_exit_status(&vspipe_status));
794821
}
795822

796823
if !output.status.success() {
797-
bail!("ffmpeg encoder exited with code {}", output.status.code().unwrap_or(-1));
824+
bail!("ffmpeg encoder exited with {}", format_exit_status(&output.status));
798825
}
799826

800827
// Write PNG to stdout

0 commit comments

Comments
 (0)