Skip to content

Commit ada9515

Browse files
committed
Enable hook tests for windows
1 parent aee6beb commit ada9515

File tree

4 files changed

+9
-95
lines changed

4 files changed

+9
-95
lines changed

Cargo.lock

Lines changed: 0 additions & 70 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/portable/windows.rs

Lines changed: 4 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ use std::time::{Duration, SystemTime};
1313
use anyhow::Context;
1414
use const_format::formatcp;
1515
use fn_error_context::context;
16-
use gel_tokio::InstanceName;
1716
use gel_tokio::dsn::CredentialsFile;
17+
use gel_tokio::InstanceName;
1818
use url::Url;
1919

2020
use crate::async_util;
@@ -33,13 +33,13 @@ use crate::portable::instance::control;
3333
use crate::portable::instance::create;
3434
use crate::portable::instance::destroy;
3535
use crate::portable::instance::status;
36-
use crate::portable::local::{InstanceInfo, NonLocalInstance, Paths, write_json};
36+
use crate::portable::local::{write_json, InstanceInfo, NonLocalInstance, Paths};
3737
use crate::portable::options;
3838
use crate::portable::project;
39-
use crate::portable::repository::{self, PackageHash, PackageInfo, download};
39+
use crate::portable::repository::{self, download, PackageHash, PackageInfo};
4040
use crate::portable::server;
4141
use crate::portable::ver;
42-
use crate::print::{self, Highlight, msg};
42+
use crate::print::{self, msg, Highlight};
4343
use crate::process;
4444

4545
use super::extension;
@@ -103,21 +103,6 @@ impl Wsl {
103103
pro.no_proxy();
104104
pro
105105
}
106-
pub fn sh(&self, _current_dir: &Path) -> process::Native {
107-
let mut pro = process::Native::new("sh", "sh", "wsl");
108-
pro.arg("--user").arg("edgedb");
109-
pro.arg("--distribution").arg(&self.distribution);
110-
pro.arg("_EDGEDB_FROM_WINDOWS=1");
111-
if let Some(log_env) = env::var_os("RUST_LOG") {
112-
let mut pair = OsString::with_capacity("RUST_LOG=".len() + log_env.len());
113-
pair.push("RUST_LOG=");
114-
pair.push(log_env);
115-
pro.arg(pair);
116-
}
117-
// TODO: set current dir
118-
pro.arg("/bin/sh");
119-
pro
120-
}
121106
#[cfg(windows)]
122107
#[allow(dead_code)]
123108
fn copy_out(&self, src: impl AsRef<str>, destination: impl AsRef<Path>) -> anyhow::Result<()> {

src/watch/scripts.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ use std::path;
22
use std::sync::Arc;
33
use tokio::sync::mpsc::UnboundedReceiver;
44

5-
use crate::portable::windows;
65
use crate::print;
76
use crate::process;
87

@@ -43,19 +42,20 @@ pub async fn run_script(
4342
script: &str,
4443
current_dir: &path::Path,
4544
) -> Result<std::process::ExitStatus, anyhow::Error> {
45+
let marker = marker.to_string();
46+
4647
let status = if !cfg!(windows) {
47-
let marker = marker.to_string();
4848
process::Native::new("", marker, "/bin/sh")
4949
.arg("-c")
5050
.arg(script)
5151
.current_dir(current_dir)
5252
.run_for_status()
5353
.await?
5454
} else {
55-
let wsl = windows::try_get_wsl()?;
56-
wsl.sh(current_dir)
57-
.arg("-c")
55+
process::Native::new("", marker, "cmd.exe")
56+
.arg("/c")
5857
.arg(script)
58+
.current_dir(current_dir)
5959
.run_for_status()
6060
.await?
6161
};

tests/portable_project.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,6 @@ fn project_link_and_init() {
239239
}
240240

241241
#[test]
242-
#[cfg(not(target_os = "windows"))]
243242
fn hooks() {
244243
use std::{fs, path};
245244

0 commit comments

Comments
 (0)