Skip to content

Commit

Permalink
- fix: docker mount windows
Browse files Browse the repository at this point in the history
  • Loading branch information
agallardol committed Nov 17, 2024
1 parent 02bcef5 commit f4ef07d
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions libs/shinkai-tools-runner/src/tools/deno_runner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,16 @@ impl DenoRunner {
let execution_storage = DenoExecutionStorage::new(self.options.context.clone());
execution_storage.init(code, None)?;

let mount_param = format!("{}:/app", execution_storage.root.to_str().unwrap());

let mount_param = format!(
r#"type=bind,source={},target=/app"#,
execution_storage
.root
.canonicalize()
.unwrap()
.to_str()
.unwrap()
.replace("\\\\?\\", "")
);
let mut container_envs = Vec::<String>::new();

container_envs.push(String::from("-e"));
Expand All @@ -95,7 +103,7 @@ impl DenoRunner {
}
let code_entrypoint = execution_storage.get_relative_code_entrypoint()?;
let mut command = tokio::process::Command::new("docker");
let mut args = ["run", "-it", "-v", mount_param.as_str()].to_vec();
let mut args = ["run", "-it", "--mount", mount_param.as_str()].to_vec();
args.extend(container_envs.iter().map(|s| s.as_str()));
args.extend([
"--workdir",
Expand All @@ -119,10 +127,10 @@ impl DenoRunner {
e
})?;

let stdout = child.stdout.take().expect("Failed to get stdout");
let stdout = child.stdout.take().expect("failed to get stdout");
let mut stdout_stream = BufReader::new(stdout).lines();

let stderr = child.stderr.take().expect("Failed to get stderr");
let stderr = child.stderr.take().expect("failed to get stderr");
let mut stderr_stream = BufReader::new(stderr).lines();

let mut stdout_lines = Vec::new();
Expand Down

0 comments on commit f4ef07d

Please sign in to comment.