mirror of
https://github.com/aljazceru/goose.git
synced 2025-12-18 06:34:26 +01:00
fix: set permissions for quickscript (#2691)
This commit is contained in:
@@ -8,6 +8,9 @@ use std::{
|
||||
};
|
||||
use tokio::process::Command;
|
||||
|
||||
#[cfg(unix)]
|
||||
use std::os::unix::fs::PermissionsExt;
|
||||
|
||||
use mcp_core::{
|
||||
handler::{PromptError, ResourceError, ToolError},
|
||||
prompt::Prompt,
|
||||
@@ -743,6 +746,23 @@ impl ComputerControllerRouter {
|
||||
ToolError::ExecutionError(format!("Failed to write script: {}", e))
|
||||
})?;
|
||||
|
||||
// Set execute permissions on Unix systems
|
||||
#[cfg(unix)]
|
||||
{
|
||||
let mut perms = fs::metadata(&script_path)
|
||||
.map_err(|e| {
|
||||
ToolError::ExecutionError(format!("Failed to get file metadata: {}", e))
|
||||
})?
|
||||
.permissions();
|
||||
perms.set_mode(0o755); // rwxr-xr-x
|
||||
fs::set_permissions(&script_path, perms).map_err(|e| {
|
||||
ToolError::ExecutionError(format!(
|
||||
"Failed to set execute permissions: {}",
|
||||
e
|
||||
))
|
||||
})?;
|
||||
}
|
||||
|
||||
script_path.display().to_string()
|
||||
}
|
||||
"ruby" => {
|
||||
|
||||
Reference in New Issue
Block a user