|
1 | 1 | // Copyright 2018-2024 the Deno authors. MIT license. |
2 | 2 |
|
3 | | -use anyhow::Context; |
4 | | -use futures::future::LocalBoxFuture; |
5 | | -use pretty_assertions::assert_eq; |
6 | 3 | use std::collections::HashMap; |
7 | 4 | use std::ffi::OsString; |
8 | 5 | use std::fs; |
| 6 | +use std::path::Path; |
9 | 7 | use std::path::PathBuf; |
10 | 8 | use std::rc::Rc; |
11 | | -use tokio::task::JoinHandle; |
12 | 9 |
|
13 | | -use crate::ShellCommand; |
14 | | -use crate::ShellCommandContext; |
15 | | -use crate::execute_with_pipes; |
16 | | -use crate::parser::parse; |
17 | | -use crate::shell::fs_util; |
18 | | -use crate::shell::types::KillSignal; |
19 | | -use crate::shell::types::ShellPipeWriter; |
20 | | -use crate::shell::types::ShellState; |
21 | | -use crate::shell::types::pipe; |
| 10 | +use anyhow::Context; |
| 11 | +use futures::future::LocalBoxFuture; |
| 12 | +use pretty_assertions::assert_eq; |
| 13 | +use deno_task_shell::ShellCommand; |
| 14 | +use tokio::task::JoinHandle; |
| 15 | +use deno_task_shell::ShellCommandContext; |
| 16 | +use deno_task_shell::execute_with_pipes; |
| 17 | +use deno_task_shell::parser::parse; |
| 18 | +use deno_task_shell::KillSignal; |
| 19 | +use deno_task_shell::ShellPipeWriter; |
| 20 | +use deno_task_shell::ShellState; |
| 21 | +use deno_task_shell::pipe; |
22 | 22 |
|
23 | | -use super::types::ExecuteResult; |
| 23 | +use deno_task_shell::ExecuteResult; |
24 | 24 |
|
25 | 25 | type FnShellCommandExecute = |
26 | 26 | Box<dyn Fn(ShellCommandContext) -> LocalBoxFuture<'static, ExecuteResult>>; |
@@ -54,7 +54,7 @@ struct TempDir { |
54 | 54 | impl TempDir { |
55 | 55 | pub fn new() -> Self { |
56 | 56 | let temp_dir = tempfile::tempdir().unwrap(); |
57 | | - let cwd = fs_util::canonicalize_path(temp_dir.path()).unwrap(); |
| 57 | + let cwd = canonicalize_path(temp_dir.path()).unwrap(); |
58 | 58 | Self { |
59 | 59 | _inner: temp_dir, |
60 | 60 | cwd, |
@@ -297,3 +297,7 @@ fn get_output_writer_and_handle() -> (ShellPipeWriter, JoinHandle<String>) { |
297 | 297 | let handle = reader.pipe_to_string_handle(); |
298 | 298 | (writer, handle) |
299 | 299 | } |
| 300 | + |
| 301 | +fn canonicalize_path(path: &Path) -> std::io::Result<PathBuf> { |
| 302 | + Ok(deno_path_util::strip_unc_prefix(path.canonicalize()?)) |
| 303 | +} |
0 commit comments