Skip to content
This repository has been archived by the owner on May 8, 2023. It is now read-only.

Commit

Permalink
run | doesn't work if you generate a .app package
Browse files Browse the repository at this point in the history
  • Loading branch information
pieterclaerhout committed Oct 31, 2019
1 parent aa9c0df commit fabcaa8
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion internal/runner/runner.go
Original file line number Diff line number Diff line change
@@ -1,21 +1,30 @@
package runner

import (
"runtime"

"github.com/pieterclaerhout/go-james/internal/common"
"github.com/pieterclaerhout/go-james/internal/config"
)

// Runner implements the "run" command
type Runner struct {
common.CommandRunner
common.FileSystem

Args []string
}

// Execute executes the command
func (runner Runner) Execute(project common.Project, cfg config.Config) error {

runCmd := []string{project.RelPath(cfg.Build.OutputPath, cfg.Project.Name)}
appPath := project.RelPath(cfg.Build.OutputPath, cfg.Project.Name)
runCmd := []string{appPath}

if runtime.GOOS == "darwin" && !runner.FileExists(appPath) && runner.DirExists(appPath+".app") {
runCmd = []string{"open", appPath + ".app"}
}

runCmd = append(runCmd, runner.Args...)

return runner.RunToStdout(runCmd, project.Path, cfg.Run.Environ)
Expand Down

0 comments on commit fabcaa8

Please sign in to comment.