Liquidsoap code moved to radio package. ErrNotRunning -> ErrLiquidsoapNotRunning.
This commit is contained in:
parent
73fc9861fd
commit
e8e3570a8f
@ -1,4 +1,4 @@
|
|||||||
package liquidsoap
|
package radio
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"os/exec"
|
"os/exec"
|
||||||
@ -7,7 +7,7 @@ import (
|
|||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
)
|
)
|
||||||
|
|
||||||
var ErrNotRunning = errors.New("liquidsoap is not running")
|
var ErrLiquidsoapNotRunning = errors.New("liquidsoap is not running")
|
||||||
|
|
||||||
type Liquidsoap struct {
|
type Liquidsoap struct {
|
||||||
command *exec.Cmd
|
command *exec.Cmd
|
||||||
@ -20,7 +20,7 @@ func NewLiquidsoap(liquidsoapPath, scriptPath string) (*Liquidsoap, error) {
|
|||||||
|
|
||||||
out, err := exec.Command(liquidsoapPath, "--verbose", "-c", scriptPath).CombinedOutput()
|
out, err := exec.Command(liquidsoapPath, "--verbose", "-c", scriptPath).CombinedOutput()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, errors.Wrap(err, "cannot check script")
|
return nil, errors.Wrap(err, "script cannot be validated")
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(out) > 0 {
|
if len(out) > 0 {
|
||||||
@ -39,7 +39,7 @@ func NewLiquidsoap(liquidsoapPath, scriptPath string) (*Liquidsoap, error) {
|
|||||||
|
|
||||||
func (l *Liquidsoap) Stop() error {
|
func (l *Liquidsoap) Stop() error {
|
||||||
if l.command.Process == nil && l.command.ProcessState != nil {
|
if l.command.Process == nil && l.command.ProcessState != nil {
|
||||||
return ErrNotRunning
|
return ErrLiquidsoapNotRunning
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := l.command.Process.Signal(syscall.SIGINT); err != nil {
|
if err := l.command.Process.Signal(syscall.SIGINT); err != nil {
|
Loading…
Reference in New Issue
Block a user