File: servicetest_unix_test.go

package info (click to toggle)
golang-github-kardianos-service 1.2.4-1
  • links: PTS, VCS
  • area: main
  • in suites:
  • size: 324 kB
  • sloc: makefile: 40; sh: 3
file content (24 lines) | stat: -rw-r--r-- 608 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
// Copyright 2016 Lawrence Woodman <lwoodman@vlifesystems.com>
// Use of this source code is governed by a zlib-style
// license that can be found in the LICENSE file.

//go:build darwin || dragonfly || freebsd || linux || nacl || netbsd || openbsd || solaris
// +build darwin dragonfly freebsd linux nacl netbsd openbsd solaris

package service_test

import (
	"os"
	"testing"
)

func interruptProcess(t *testing.T) {
	pid := os.Getpid()
	p, err := os.FindProcess(pid)
	if err != nil {
		t.Fatalf("FindProcess: %s", err)
	}
	if err := p.Signal(os.Interrupt); err != nil {
		t.Fatalf("Signal: %s", err)
	}
}