mirror of
				https://github.com/edera-dev/krata.git
				synced 2025-11-03 23:29:39 +00:00 
			
		
		
		
	hypha: init will now watch process in background
This commit is contained in:
		@ -1,10 +1,20 @@
 | 
			
		||||
use std::env;
 | 
			
		||||
use anyhow::Result;
 | 
			
		||||
use anyhow::{anyhow, Result};
 | 
			
		||||
use hypha::container::init::ContainerInit;
 | 
			
		||||
use std::env;
 | 
			
		||||
 | 
			
		||||
fn main() -> Result<()> {
 | 
			
		||||
    env::set_var("RUST_BACKTRACE", "1");
 | 
			
		||||
    env_logger::init();
 | 
			
		||||
    if env::var("HYPHA_UNSAFE_ALWAYS_ALLOW_INIT").unwrap_or("0".to_string()) != "1" {
 | 
			
		||||
        let pid = std::process::id();
 | 
			
		||||
        if pid > 3 {
 | 
			
		||||
            return Err(anyhow!(
 | 
			
		||||
                "not running because the pid of {} indicates this is probably not \
 | 
			
		||||
                    the right context for the init daemon. \
 | 
			
		||||
                        run with HYPHA_UNSAFE_ALWAYS_ALLOW_INIT=1 to bypass this check",
 | 
			
		||||
                pid
 | 
			
		||||
            ));
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
    let mut container = ContainerInit::new();
 | 
			
		||||
    container.init()?;
 | 
			
		||||
    Ok(())
 | 
			
		||||
 | 
			
		||||
@ -1,4 +1,3 @@
 | 
			
		||||
use std::env;
 | 
			
		||||
use anyhow::{anyhow, Result};
 | 
			
		||||
use clap::{Parser, Subcommand};
 | 
			
		||||
use hypha::ctl::Controller;
 | 
			
		||||
@ -47,7 +46,6 @@ enum Commands {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
fn main() -> Result<()> {
 | 
			
		||||
    env::set_var("RUST_BACKTRACE", "1");
 | 
			
		||||
    env_logger::init();
 | 
			
		||||
 | 
			
		||||
    let args = ControllerArgs::parse();
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user