java
if (!isWindows) {
try {
Runtime.getRuntime().exec(new String[]{"/bin/chmod", "755", ffmpegFile.getAbsolutePath()});
} catch (IOException var11) {
LOG.error("Error setting executable via chmod", var11);
}
}
Suggested Technical Context (for reports/bug tracking):
"The issue occurs when the FFmpeg binary is copied to /tmp/jave/ but the chmod operation (to set 755 permissions) hasn’t finished before the process attempts execution. This race condition triggers Java’s IOException with error=13 (Permission denied)."
Possible Solutions:
Add a permission check after exec chmod:
java
if (!file.canExecute()) {
LOG.warn("File is still not executable after chmod, retrying...");
// retry
if (!file.setExecutable(true)) {
LOG.error("Failed to set executable permission for: {}", filePath);
}
}
Synchronize the copy + chmod process (e.g., use Process.waitFor() after chmod).
Retry logic (if the first attempt fails due to permissions).
Let me know if you need further refinement!