Not syncing stdout and stderr of pluging with client

This commit is contained in:
Diptanu Choudhury
2016-02-04 17:36:31 -08:00
parent 9800b7dcfe
commit d8ed2949cd
8 changed files with 30 additions and 13 deletions

View File

@@ -1,6 +1,7 @@
package command
import (
"os"
"strings"
"github.com/hashicorp/go-plugin"
@@ -24,9 +25,19 @@ func (e *ExecutorPluginCommand) Synopsis() string {
}
func (e *ExecutorPluginCommand) Run(args []string) int {
if len(args) == 0 {
e.Ui.Error("log output file isn't provided")
return 1
}
logFileName := args[0]
stdo, err := os.OpenFile(logFileName, os.O_CREATE|os.O_RDWR|os.O_APPEND, 0666)
if err != nil {
e.Ui.Error(err.Error())
return 1
}
plugin.Serve(&plugin.ServeConfig{
HandshakeConfig: driver.HandshakeConfig,
Plugins: driver.PluginMap,
Plugins: driver.GetPluginMap(stdo),
})
return 0
}