Skip to content

Commit

Permalink
[executor] Unbreak build on Mac
Browse files Browse the repository at this point in the history
  • Loading branch information
teo committed Jun 2, 2020
1 parent 9f174e9 commit 8779cc3
Show file tree
Hide file tree
Showing 3 changed files with 63 additions and 1 deletion.
2 changes: 1 addition & 1 deletion executor/executable/task.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ func prepareTaskCmd(commandInfo *common.TaskCommandInfo) (*exec.Cmd, error) {
// We must setpgid(2) in order to be able to kill the whole process group which consists of
// the containing shell and all of its children
taskCmd.SysProcAttr = &syscall.SysProcAttr{Setpgid: true}
taskCmd.SysProcAttr.Pdeathsig = syscall.SIGKILL
setPdeathsig(taskCmd.SysProcAttr)

// If the commandInfo specifies a username
if commandInfo.User != nil && len(*commandInfo.User) > 0 {
Expand Down
31 changes: 31 additions & 0 deletions executor/executable/task_pdeathsig_darwin.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/*
* === This file is part of ALICE O² ===
*
* Copyright 2020 CERN and copyright holders of ALICE O².
* Author: Teo Mrnjavac <teo.mrnjavac@cern.ch>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* In applying this license CERN does not waive the privileges and
* immunities granted to it by virtue of its status as an
* Intergovernmental Organization or submit itself to any jurisdiction.
*/

package executable

import "syscall"

func setPdeathsig(sysProcAttr *syscall.SysProcAttr) {
//noop
}
31 changes: 31 additions & 0 deletions executor/executable/task_pdeathsig_linux.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/*
* === This file is part of ALICE O² ===
*
* Copyright 2020 CERN and copyright holders of ALICE O².
* Author: Teo Mrnjavac <teo.mrnjavac@cern.ch>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* In applying this license CERN does not waive the privileges and
* immunities granted to it by virtue of its status as an
* Intergovernmental Organization or submit itself to any jurisdiction.
*/

package executable

import "syscall"

func setPdeathsig(sysProcAttr *syscall.SysProcAttr) {
sysProcAttr.Pdeathsig = syscall.SIGKILL
}

0 comments on commit 8779cc3

Please sign in to comment.