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) };