From 5bc830baa0baba0bdcb6995e44bd3122619f7f8e Mon Sep 17 00:00:00 2001 From: Lukylix Date: Fri, 21 Jun 2024 22:55:48 +0200 Subject: [PATCH] Wide path convertion --- crates/gitbutler-git/src/bin/askpass/windows-pipe.rs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/crates/gitbutler-git/src/bin/askpass/windows-pipe.rs b/crates/gitbutler-git/src/bin/askpass/windows-pipe.rs index 6a4772f74..6a11a537e 100644 --- a/crates/gitbutler-git/src/bin/askpass/windows-pipe.rs +++ b/crates/gitbutler-git/src/bin/askpass/windows-pipe.rs @@ -58,9 +58,11 @@ pub struct Pipe { impl Pipe { pub fn connect(path: &Path) -> io::Result { - let mut os_str: OsString = path.as_os_str().into(); - os_str.push("\x00"); - let mut wide_path: Vec = os_str.encode_wide().collect(); + let mut wide_path: Vec = path + .as_os_str() + .encode_wide() + .chain(std::iter::once(0)) + .collect(); let pwstr_path = PWSTR(wide_path.as_mut_ptr()); let _ = unsafe { WaitNamedPipeW(pwstr_path, NMPWAIT_USE_DEFAULT_WAIT) };