-
-
Notifications
You must be signed in to change notification settings - Fork 119
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
gio::SubprocessLauncher::set_environ
and gio::ApplicationCommandLine::environ
don't compose well
#1638
Comments
It should really take an And then this could simply become a
Probably just forgotten / wasn't needed yet. Do you want to add that? |
Just opened PR #1641. |
The problem is that |
and
gio::ApplicationCommandLine::environ` don't composed wellgio::SubprocessLauncher::set_environ
and gio::ApplicationCommandLine::environ
don't compose well
Here's the Rust error message:
I've found another place that takes a slice of environment variables at Lines 356 to 359 in 35e15b7
So maybe just use |
Yes that probably makes most sense for now |
I noticed that
gio::ApplicationCommandLine::environ
returns aVec<OsString>
and thatgio::SubprocessLauncher::set_environ
only takes a&[&Path]
as argument.This seems rather unfortunate. My application should share a primary instance for multiple windows, but still needs to spawn processes with the environment that spawned a new window on the primary instance. This currently needs an intermediate collection to collect the
Path
references that can be passed togio::SubprocessLauncher::set_environ
.This could be generic over all
ToGlibContainerFromSlice
types that coerce properly like&OsStr
,&str
,&Path
and their owned variantsOsString
,String
,PathBuf
.I think an intermediary trait for all kinds of
OsStr
-like values could help to make thegio::SubprocessLauncher::set_environ
method more usable.Maybe something like
fn set_environ<'a>(&self, envs: &'a [impl AsOsStr<'a>])
? WhereAsOsStr<'a>
is a subtrait ofglib::translate::ToGlibContainerFromSlice<'a, *const *const i8>
so the.to_glib_none()
in the generated bindings still works?On a side-note: Why doesn't
CString
and&CStr
implementToGlibContainerFromSlice
?It's just a minor inconvenience but I wanted to start some discussion on these
OsStr
-like slices in function arguments.The text was updated successfully, but these errors were encountered: