Skip to content

Commit

Permalink
Merge pull request #322 from StephenButtolph/win-c-chain
Browse files Browse the repository at this point in the history
Removed `sh` dependency in the rpcchainvm
  • Loading branch information
StephenButtolph authored Aug 24, 2020
2 parents 053a094 + 70c4da3 commit e00a68b
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 14 deletions.
4 changes: 2 additions & 2 deletions ipcs/chainipc.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ package ipcs

import (
"fmt"
"path"
"path/filepath"

"github.com/ava-labs/gecko/ids"
"github.com/ava-labs/gecko/snow/triggers"
Expand Down Expand Up @@ -87,5 +87,5 @@ func (cipcs *ChainIPCs) Unpublish(chainID ids.ID) (bool, error) {
}

func ipcURL(ctx context, chainID ids.ID, eventType string) string {
return path.Join(ctx.path, fmt.Sprintf("%d-%s-%s", ctx.networkID, chainID.String(), eventType))
return filepath.Join(ctx.path, fmt.Sprintf("%d-%s-%s", ctx.networkID, chainID.String(), eventType))
}
4 changes: 2 additions & 2 deletions main/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ package main

import (
"fmt"
"path"
"path/filepath"

"github.com/ava-labs/gecko/nat"
"github.com/ava-labs/gecko/node"
Expand All @@ -22,7 +22,7 @@ func main() {
}

config := Config.LoggingConfig
config.Directory = path.Join(config.Directory, "node")
config.Directory = filepath.Join(config.Directory, "node")
factory := logging.NewFactory(config)
defer factory.Close()

Expand Down
4 changes: 2 additions & 2 deletions node/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
"io/ioutil"
"net"
"os"
"path"
"path/filepath"
"sync"
"time"

Expand Down Expand Up @@ -461,7 +461,7 @@ func (n *Node) initChainManager(avaxAssetID ids.ID) error {
Fee: n.Config.TxFee,
}),
n.vmManager.RegisterVMFactory(genesis.EVMID, &rpcchainvm.Factory{
Path: path.Join(n.Config.PluginDir, "evm"),
Path: filepath.Join(n.Config.PluginDir, "evm"),
}),
n.vmManager.RegisterVMFactory(spdagvm.ID, &spdagvm.Factory{
TxFee: n.Config.TxFee,
Expand Down
8 changes: 3 additions & 5 deletions utils/logging/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@

package logging

import (
"path"
)
import "path/filepath"

// Factory ...
type Factory interface {
Expand Down Expand Up @@ -42,7 +40,7 @@ func (f *factory) Make() (Logger, error) {
func (f *factory) MakeChain(chainID string, subdir string) (Logger, error) {
config := f.config
config.MsgPrefix = chainID + " Chain"
config.Directory = path.Join(config.Directory, "chain", chainID, subdir)
config.Directory = filepath.Join(config.Directory, "chain", chainID, subdir)

log, err := New(config)
if err == nil {
Expand All @@ -54,7 +52,7 @@ func (f *factory) MakeChain(chainID string, subdir string) (Logger, error) {
// MakeSubdir ...
func (f *factory) MakeSubdir(subdir string) (Logger, error) {
config := f.config
config.Directory = path.Join(config.Directory, subdir)
config.Directory = filepath.Join(config.Directory, subdir)

log, err := New(config)
if err == nil {
Expand Down
4 changes: 2 additions & 2 deletions utils/logging/log.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"bufio"
"fmt"
"os"
"path"
"path/filepath"
"runtime"
"strings"
"sync"
Expand Down Expand Up @@ -351,7 +351,7 @@ func (fw *fileWriter) Rotate() error {
}

func (fw *fileWriter) create(fileIndex int) (*bufio.Writer, *os.File, error) {
filename := path.Join(fw.config.Directory, fmt.Sprintf("%d.log", fw.fileIndex))
filename := filepath.Join(fw.config.Directory, fmt.Sprintf("%d.log", fw.fileIndex))
file, err := os.Create(filename)
if err != nil {
return nil, nil, err
Expand Down
2 changes: 1 addition & 1 deletion vms/rpcchainvm/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ func (f *Factory) New(ctx *snow.Context) (interface{}, error) {
config := &plugin.ClientConfig{
HandshakeConfig: Handshake,
Plugins: PluginMap,
Cmd: exec.Command("sh", "-c", f.Path),
Cmd: exec.Command(f.Path),
AllowedProtocols: []plugin.Protocol{
plugin.ProtocolNetRPC,
plugin.ProtocolGRPC,
Expand Down

0 comments on commit e00a68b

Please sign in to comment.