mirror of
				https://github.com/sammy-ette/Hilbish
				synced 2025-08-10 02:52:03 +00:00 
			
		
		
		
	* feat: add hilbish.job.add function this is mainly to accomodate for the employer handler (#152) * feat!: add start function to jobs the commit itself adds a few things but the main purpose is to facilitate a lua side start function that can restart the job there is a breaking change in the hilbish.job.add function; it is now required to provide an extra table for arguments, since the first cmd table isnt really what's actually ran * fix: reuse standard files for jobs * fix: deadlock in lua job add function and not taking proper amount of args * fix: assign binary path to job * feat: emit job.add hook when job is added * chore: update modules * fix: use setpgid on cmd procattr for background jobs * fix: use right procattr on correct os * fix: set bg proc attr in build tagged file * feat: add disown function * fix: stop jobs on exit * feat: add disown command * feat: add jobs.last function to get last job * feat: make disown command get last job if id isnt suppied as arg * chore: remove unused code * feat: add job output * chore: fix comments * fix!: make exec path in job add explicit in lua side * docs: add docs and changelogs relating to jobs
		
			
				
	
	
		
			30 lines
		
	
	
		
			431 B
		
	
	
	
		
			Go
		
	
	
	
	
	
			
		
		
	
	
			30 lines
		
	
	
		
			431 B
		
	
	
	
		
			Go
		
	
	
	
	
	
// +build linux darwin
 | 
						|
 | 
						|
package main
 | 
						|
 | 
						|
import (
 | 
						|
	"os"
 | 
						|
	"syscall"
 | 
						|
)
 | 
						|
 | 
						|
var bgProcAttr *syscall.SysProcAttr = &syscall.SysProcAttr{
 | 
						|
	Setpgid: true,
 | 
						|
}
 | 
						|
 | 
						|
func findExecutable(path string, inPath, dirs bool) error {
 | 
						|
	f, err := os.Stat(path)
 | 
						|
	if err != nil {
 | 
						|
		return err
 | 
						|
	}
 | 
						|
	if dirs {
 | 
						|
		if m := f.Mode(); m & 0111 != 0 {
 | 
						|
			return nil
 | 
						|
		}
 | 
						|
	} else {
 | 
						|
		if m := f.Mode(); !m.IsDir() && m & 0111 != 0 {
 | 
						|
			return nil
 | 
						|
		}
 | 
						|
	}
 | 
						|
	return errNotExec
 | 
						|
}
 |