summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorMarkus Pettersson <markus.pettersson@mullvad.net>2025-09-12 23:17:31 +0200
committerMarkus Pettersson <markus.pettersson@mullvad.net>2025-10-09 10:41:01 +0200
commitc5b6e9d3f6032e3310fbe4f7ab07004db0efffc2 (patch)
treedc7cf5d0d14098dcaee16e9ba56106c9da2cd69e
parent5aa9070f76bc1500b99a20a88ac21c3ea613dec7 (diff)
downloadmullvadvpn-c5b6e9d3f6032e3310fbe4f7ab07004db0efffc2.tar.xz
mullvadvpn-c5b6e9d3f6032e3310fbe4f7ab07004db0efffc2.zip
Remove `duct` from `talpid-core`
-rw-r--r--Cargo.lock33
-rw-r--r--talpid-core/Cargo.toml1
-rw-r--r--talpid-core/src/dns/linux/resolvconf.rs31
3 files changed, 20 insertions, 45 deletions
diff --git a/Cargo.lock b/Cargo.lock
index 32668c73e4..1f818d4728 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -1229,18 +1229,6 @@ dependencies = [
]
[[package]]
-name = "duct"
-version = "0.13.7"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e4ab5718d1224b63252cd0c6f74f6480f9ffeb117438a2e0f5cf6d9a4798929c"
-dependencies = [
- "libc",
- "once_cell",
- "os_pipe",
- "shared_child",
-]
-
-[[package]]
name = "dunce"
version = "1.0.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -3895,16 +3883,6 @@ dependencies = [
]
[[package]]
-name = "os_pipe"
-version = "1.1.5"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "57119c3b893986491ec9aa85056780d3a0f3cf4da7cc09dd3650dbd6c6738fb9"
-dependencies = [
- "libc",
- "windows-sys 0.52.0",
-]
-
-[[package]]
name = "oslog"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -5261,16 +5239,6 @@ dependencies = [
]
[[package]]
-name = "shared_child"
-version = "1.0.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b0d94659ad3c2137fef23ae75b03d5241d633f8acded53d672decfa0e6e0caef"
-dependencies = [
- "libc",
- "winapi",
-]
-
-[[package]]
name = "shell-escape"
version = "0.1.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -5524,7 +5492,6 @@ dependencies = [
"bitflags 2.9.0",
"chrono",
"csv",
- "duct",
"either",
"futures",
"hickory-proto",
diff --git a/talpid-core/Cargo.toml b/talpid-core/Cargo.toml
index 4f99bd9c5a..531b9fcff9 100644
--- a/talpid-core/Cargo.toml
+++ b/talpid-core/Cargo.toml
@@ -47,7 +47,6 @@ nftnl = { version = "0.7.0", features = ["nftnl-1-1-0"] }
mnl = { version = "0.2.2", features = ["mnl-1-0-4"] }
which = { version = "4.0", default-features = false }
talpid-dbus = { path = "../talpid-dbus" }
-duct = "0.13"
[target.'cfg(target_os = "macos")'.dependencies]
diff --git a/talpid-core/src/dns/linux/resolvconf.rs b/talpid-core/src/dns/linux/resolvconf.rs
index 0e1ac33c30..d98d234458 100644
--- a/talpid-core/src/dns/linux/resolvconf.rs
+++ b/talpid-core/src/dns/linux/resolvconf.rs
@@ -1,9 +1,11 @@
use std::{
collections::HashSet,
ffi::OsStr,
- fs, io,
+ fs,
+ io::{self, Write},
net::IpAddr,
path::{Path, PathBuf},
+ process::{Command, Stdio},
};
use which::which;
@@ -85,12 +87,20 @@ impl Resolvconf {
record_contents.push('\n');
}
- let output = duct::cmd!(&self.resolvconf, "-a", &record_name)
- .stdin_bytes(record_contents)
- .stderr_capture()
- .unchecked()
- .run()
- .map_err(Error::RunResolvconf)?;
+ let output = {
+ let mut resolveconf = Command::new(&self.resolvconf);
+ let mut child = resolveconf
+ .stdin(Stdio::piped())
+ .stderr(Stdio::piped())
+ .args(["-a", &record_name])
+ .spawn()?;
+ let mut stdin = child.stdin.take().expect("stdin to be present");
+ stdin
+ .write_all(record_contents.as_bytes())
+ .map_err(Error::RunResolvconf)?;
+ drop(stdin);
+ child.wait_with_output()?
+ };
if !output.status.success() {
let stderr = String::from_utf8_lossy(&output.stderr).to_string();
@@ -106,10 +116,9 @@ impl Resolvconf {
let mut result = Ok(());
for record_name in self.record_names.drain() {
- let output = duct::cmd!(&self.resolvconf, "-d", &record_name, "-f")
- .stderr_capture()
- .unchecked()
- .run()
+ let output = Command::new(&self.resolvconf)
+ .args(["-d", &record_name, "-f"])
+ .output()
.map_err(Error::RunResolvconf)?;
if !output.status.success() {