Skip to content

Commit bcbe6aa

Browse files
fix: cleanup orphan processes on linux
1 parent d5c9a26 commit bcbe6aa

File tree

4 files changed

+26
-2
lines changed

4 files changed

+26
-2
lines changed

cmd/semantic-release/main.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ func cliHandler(cmd *cobra.Command, args []string) {
7474
pluginManager, err := manager.New(conf)
7575
exitIfError(err)
7676
exitHandler = func() {
77+
logger.Println("stopping plugins...")
7778
pluginManager.Stop()
7879
}
7980

pkg/plugin/discovery/discovery.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ func (d *Discovery) fetchPlugin(name, pth string, cons *semver.Constraints) (str
167167

168168
releaseAsset := pluginInfo.Versions[foundVersion].getMatchingAsset()
169169
if releaseAsset == nil {
170-
return "", errors.New("release not found")
170+
return "", fmt.Errorf("a matching plugin was not found for %s/%s", runtime.GOOS, runtime.GOARCH)
171171
}
172172

173173
targetPath := path.Join(pth, foundVersion, releaseAsset.FileName)
@@ -304,9 +304,12 @@ func (d *Discovery) FindPlugin(t, name string) (*plugin.PluginOpts, error) {
304304
}
305305
}
306306

307+
cmd := exec.Command(binPath)
308+
cmd.SysProcAttr = GetSysProcAttr()
309+
307310
return &plugin.PluginOpts{
308311
Type: t,
309312
PluginName: pName,
310-
Cmd: exec.Command(binPath),
313+
Cmd: cmd,
311314
}, nil
312315
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
// +build !linux
2+
3+
package discovery
4+
5+
import "syscall"
6+
7+
func GetSysProcAttr() *syscall.SysProcAttr {
8+
return nil
9+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
// +build linux
2+
3+
package discovery
4+
5+
import "syscall"
6+
7+
func GetSysProcAttr() *syscall.SysProcAttr {
8+
return &syscall.SysProcAttr{
9+
Pdeathsig: syscall.SIGKILL,
10+
}
11+
}

0 commit comments

Comments
 (0)