feat: pass through arguments

This commit is contained in:
Nova
2023-01-05 08:39:11 -05:00
parent 764483ef3d
commit ca2637dc16
2 changed files with 8 additions and 4 deletions

View File

@@ -6,8 +6,7 @@ use protostar::ProtoStar;
use stardust_xr_molecules::fusion::client::Client;
use std::{
env::{args, current_dir},
path::{Path, PathBuf},
str::FromStr,
path::Path,
};
#[tokio::main(flavor = "current_thread")]

View File

@@ -13,7 +13,7 @@ use stardust_xr_molecules::{
},
GrabData, Grabbable,
};
use std::{ffi::CString, path::PathBuf, sync::Arc};
use std::{env::args, ffi::CString, path::PathBuf, sync::Arc};
use tween::{QuartInOut, Tweener};
use ustr::ustr;
@@ -91,7 +91,12 @@ impl LifeCycleHandler for ProtoStar {
std::env::set_var("STARDUST_STARTUP_TOKEN", future.await.unwrap());
if unsafe { fork() }.unwrap().is_parent() {
let executable = ustr(executable.to_str().unwrap());
execv::<CString>(executable.as_cstr(), &[]).unwrap();
let args = args()
.skip(1)
.map(|arg| CString::new(arg))
.collect::<Result<Vec<_>, _>>()
.unwrap();
execv::<CString>(executable.as_cstr(), args.as_slice()).unwrap();
}
});
}