Merge pull request #3370 from lifupan/fix_namespace

agent: fix the issue of creating new namespaces for agent
This commit is contained in:
Tim Zhang 2022-01-21 10:25:43 +08:00 committed by GitHub
commit eac003462d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -100,7 +100,7 @@ impl Namespace {
self.path = new_ns_path.clone().into_os_string().into_string().unwrap();
let hostname = self.hostname.clone();
let new_thread = tokio::spawn(async move {
let new_thread = std::thread::spawn(move || {
if let Err(err) = || -> Result<()> {
let origin_ns_path = get_current_thread_ns_path(ns_type.get());
@ -148,7 +148,7 @@ impl Namespace {
});
new_thread
.await
.join()
.map_err(|e| anyhow!("Failed to join thread {:?}!", e))??;
Ok(self)