cli: make nested/out-of-jay run-privileged a no-op
This commit is contained in:
parent
5af6de075e
commit
a29c408583
2 changed files with 15 additions and 8 deletions
|
|
@ -3,19 +3,26 @@ use {
|
|||
cli::{GlobalArgs, RunPrivilegedArgs},
|
||||
compositor::WAYLAND_DISPLAY,
|
||||
logger::Logger,
|
||||
utils::{errorfmt::ErrorFmt, oserror::OsError},
|
||||
utils::{errorfmt::ErrorFmt, oserror::OsError, xrd::xrd},
|
||||
},
|
||||
std::path::PathBuf,
|
||||
uapi::UstrPtr,
|
||||
};
|
||||
|
||||
pub fn main(global: GlobalArgs, args: RunPrivilegedArgs) {
|
||||
Logger::install_stderr(global.log_level.into());
|
||||
let mut wd = match std::env::var(WAYLAND_DISPLAY) {
|
||||
Ok(v) => v,
|
||||
_ => fatal!("{} is not set", WAYLAND_DISPLAY),
|
||||
};
|
||||
wd.push_str(".jay");
|
||||
std::env::set_var(WAYLAND_DISPLAY, &wd);
|
||||
if let Some(xrd) = xrd() {
|
||||
let mut wd = match std::env::var(WAYLAND_DISPLAY) {
|
||||
Ok(v) => v,
|
||||
_ => fatal!("{} is not set", WAYLAND_DISPLAY),
|
||||
};
|
||||
wd.push_str(".jay");
|
||||
let mut path = PathBuf::from(xrd);
|
||||
path.push(&wd);
|
||||
if path.exists() {
|
||||
std::env::set_var(WAYLAND_DISPLAY, &wd);
|
||||
}
|
||||
}
|
||||
let mut argv = UstrPtr::new();
|
||||
for arg in &args.program {
|
||||
argv.push(arg.as_str());
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue