Skip to content
This repository has been archived by the owner on Feb 24, 2024. It is now read-only.

Commit

Permalink
time out bad plugins fixes #513
Browse files Browse the repository at this point in the history
  • Loading branch information
markbates committed Jul 16, 2017
1 parent cba8924 commit 0891ea6
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion plugins/plugins.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,15 @@ package plugins

import (
"bytes"
"context"
"encoding/json"
"fmt"
"os"
"os/exec"
"path/filepath"
"runtime"
"strings"
"time"

"github.com/pkg/errors"

Expand Down Expand Up @@ -80,7 +82,9 @@ func Available() (List, error) {

func askBin(path string, ch chan Command) error {
commands := Commands{}
cmd := exec.Command(path, "available")
ctx, cancel := context.WithTimeout(context.Background(), time.Second)
defer cancel()
cmd := exec.CommandContext(ctx, path, "available")
bb := &bytes.Buffer{}
cmd.Stdout = bb
cmd.Stderr = bb
Expand Down

0 comments on commit 0891ea6

Please sign in to comment.