fix(executor/local): use syscall kill
This commit is contained in:
		
							parent
							
								
									14961db8f0
								
							
						
					
					
						commit
						2248d4e318
					
				|  | @ -101,6 +101,7 @@ func (e *Local) Run(cmds []stage.Cmd) ([]stage.ExecutorResult, error) { | ||||||
| 
 | 
 | ||||||
| 	for _, cmd := range cmds { | 	for _, cmd := range cmds { | ||||||
| 		execCmd := exec.Command(cmd.Args[0], cmd.Args[1:]...) // #nosec G204
 | 		execCmd := exec.Command(cmd.Args[0], cmd.Args[1:]...) // #nosec G204
 | ||||||
|  | 		execCmd.SysProcAttr = &syscall.SysProcAttr{Setpgid: true} | ||||||
| 		if cmd.CPULimit > 0 && cmd.ClockLimit <= 0 { | 		if cmd.CPULimit > 0 && cmd.ClockLimit <= 0 { | ||||||
| 			cmd.ClockLimit = cmd.CPULimit * 2 | 			cmd.ClockLimit = cmd.CPULimit * 2 | ||||||
| 		} | 		} | ||||||
|  | @ -158,8 +159,8 @@ func (e *Local) Run(cmds []stage.Cmd) ([]stage.ExecutorResult, error) { | ||||||
| 			) | 			) | ||||||
| 			results = append(results, result) | 			results = append(results, result) | ||||||
| 		case <-time.After(duration): | 		case <-time.After(duration): | ||||||
| 			_ = execCmd.Process.Kill() | 			_ = syscall.Kill(-execCmd.Process.Pid, syscall.SIGKILL) | ||||||
| 			err := execCmd.Wait() | 			err := <-done | ||||||
| 			result := e.generateResult( | 			result := e.generateResult( | ||||||
| 				err, | 				err, | ||||||
| 				execCmd.ProcessState, | 				execCmd.ProcessState, | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue
	
	Block a user