summaryrefslogtreecommitdiffhomepage
path: root/talpid-core/src
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 /talpid-core/src
parent5aa9070f76bc1500b99a20a88ac21c3ea613dec7 (diff)
downloadmullvadvpn-c5b6e9d3f6032e3310fbe4f7ab07004db0efffc2.tar.xz
mullvadvpn-c5b6e9d3f6032e3310fbe4f7ab07004db0efffc2.zip
Remove `duct` from `talpid-core`
Diffstat (limited to 'talpid-core/src')
-rw-r--r--talpid-core/src/dns/linux/resolvconf.rs31
1 files changed, 20 insertions, 11 deletions
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() {