diff options
| author | Přemysl Eric Janouch <p@janouch.name> | 2024-04-08 03:22:51 +0200 | 
|---|---|---|
| committer | Přemysl Eric Janouch <p@janouch.name> | 2024-04-08 03:22:51 +0200 | 
| commit | 274e71fb6a99c957ab433aeca68071ba74f9bcb0 (patch) | |
| tree | 816da5049d4c03f63bb5f5d18ba5b8cb961b8766 /acid.go | |
| parent | 7bec4772660bccfb0a1e08e91e5efb92a7f97558 (diff) | |
| download | acid-274e71fb6a99c957ab433aeca68071ba74f9bcb0.tar.gz acid-274e71fb6a99c957ab433aeca68071ba74f9bcb0.tar.xz acid-274e71fb6a99c957ab433aeca68071ba74f9bcb0.zip | |
Think about process groups
Diffstat (limited to 'acid.go')
| -rw-r--r-- | acid.go | 19 | 
1 files changed, 17 insertions, 2 deletions
| @@ -787,6 +787,22 @@ func executorRunTask(ctx context.Context, task Task) error {  		"ACID_RUNNER="+rt.DB.Runner,  	) +	// Pushing the runner into a new process group that can be killed at once +	// with all its children isn't bullet-proof, it messes with job control +	// when acid is run from an interactive shell, and it also seems avoidable +	// (use "exec" in runner scripts, so that VMs take over the process). +	// Maybe this is something that could be opt-in. +	/* +		cmd.SysProcAttr = &syscall.SysProcAttr{Setpgid: true} +		cmd.Cancel = func() error { +			err := syscall.Kill(-cmd.Process.Pid, syscall.SIGKILL) +			if err == syscall.ESRCH { +				return os.ErrProcessDone +			} +			return err +		} +	*/ +  	log.Printf("task %d for %s: starting %s\n",  		rt.DB.ID, rt.DB.FullName(), rt.Runner.Name) @@ -812,10 +828,9 @@ func executorRunTask(ctx context.Context, task Task) error {  		case <-ctxRunner.Done():  			// This doesn't leave the runner almost any time on our shutdown,  			// but whatever--they're supposed to be ephemeral. -			// Moreover, we don't even override cmd.CancelFunc.  		case <-time.After(5 * time.Second):  		} -		_ = cmd.Process.Kill() +		_ = cmd.Cancel()  	}()  	client, err := executorConnect(ctxRunner, &ssh.ClientConfig{ | 
