diff --git a/fish-rust/src/builtins/shared.rs b/fish-rust/src/builtins/shared.rs index 45e23d1a8..7052716ca 100644 --- a/fish-rust/src/builtins/shared.rs +++ b/fish-rust/src/builtins/shared.rs @@ -1,7 +1,7 @@ use crate::builtins::{printf, wait}; use crate::ffi::{self, parser_t, wcstring_list_ffi_t, Repin, RustBuiltin}; use crate::wchar::{wstr, WString, L}; -use crate::wchar_ffi::{c_str, empty_wstring, WCharFromFFI}; +use crate::wchar_ffi::{c_str, empty_wstring, ToCppWString, WCharFromFFI}; use crate::wgetopt::{wgetopter_t, wopt, woption, woption_argument_t}; use libc::c_int; use std::os::fd::RawFd; @@ -86,9 +86,9 @@ impl output_stream_t { unsafe { (*self.0).pin() } } - /// Append a &wtr or WString. + /// Append a &wstr or WString. pub fn append>(&mut self, s: Str) -> bool { - self.ffi().append1(c_str!(s)) + self.ffi().append(&s.as_ref().into_cpp()) } /// Append a char. diff --git a/tests/checks/string.fish b/tests/checks/string.fish index 52dcec924..0180d34f2 100644 --- a/tests/checks/string.fish +++ b/tests/checks/string.fish @@ -955,3 +955,8 @@ string shorten -m0 foo bar asodjsaoidj # CHECK: foo # CHECK: bar # CHECK: asodjsaoidj + +echo foo\x00bar | string escape +# CHECK: foo\x00bar +echo foo\\x00bar | string escape +# CHECK: foo\\x00bar