Files
herolib/lib/osal/zinit
Mahmoud Emad 288bfd54d8 refactor: improve zinit process handling
- Improved error handling in `get` method of Zinit struct.
- Changed the return type of `new()` function in `zinit_factory.v` to `!&Zinit`.
- Updated `zinit_global_manager` to hold references to `Zinit` instances.

Co-authored-by: mariobassem12 <mariobassem12@gmail.com>
2025-01-06 16:40:52 +02:00
..
2024-12-25 08:40:56 +01:00
2024-12-25 08:40:56 +01:00
2024-12-25 09:23:31 +01:00
2024-12-25 08:40:56 +01:00
2024-12-25 08:40:56 +01:00
2024-12-25 08:40:56 +01:00
2024-12-25 08:40:56 +01:00

a sal to work with zinit

Easy reliable way how to work with processes

Example

import freeflowuniverse.herolib.osal.zinit

fn main() {
	do() or { panic(err) }
}

fn do() ! {
	mut z:=zinit.get()!

	z.destroy()!

	// name      string            @[required]
	// cmd       string            @[required]
	// cmd_file  bool  //if we wanna force to run it as a file which is given to bash -c  (not just a cmd in zinit)
	// cmd_stop      string
	// cmd_test      string
	// test_file bool
	// after     []string
	// env       map[string]string
	// oneshot   bool
	p:=z.new(
		name:"test"
		cmd:'/bin/bash'
	)!

	output:=p.log()!
	println(output)

	p.check()! //will check the process is up and running

	p.stop()!

}

protocol defined in

sal on top of https://github.com/threefoldtech/zinit/tree/master

https://github.com/threefoldtech/zinit/blob/master/docs/protocol.md