@@ -2,23 +2,24 @@ package main
5− "github.com/replit/prybar/utils"
8 "path/filepath"
7 "path/filepath"
10+ "github.com/replit/prybar/utils"
12func Execute(config *utils.Config) {
13func Execute(config *utils.Config) {
16+ if _, err := os.Stat("Cask"); err == nil {
14− emacs, err := exec.LookPath("emacs")
17+ if _, err := exec.LookPath("cask"); err == nil {
15−
18+ args = append(args, "cask", "exec")
20 execPath, err := os.Executable()
22 execPath, err := os.Executable()
22 if err != nil {
23 if err != nil {
23 panic(err)
24 panic(err)
@@ -26,6 +27,11 @@ func Execute(config *utils.Config) {
26 runDir := filepath.Dir(execPath)
27 runDir := filepath.Dir(execPath)
27 replPath := filepath.Join(runDir, "prybar_assets", "elisp", "repl.el")
28 replPath := filepath.Join(runDir, "prybar_assets", "elisp", "repl.el")
31+ args, "emacs", "-nw", "-Q", "--load", replPath,
32+ "--eval", "(prybar-repl)",
29 os.Setenv("PRYBAR_EVAL", config.Exp)
35 os.Setenv("PRYBAR_EVAL", config.Exp)
30 os.Setenv("PRYBAR_EXEC", config.Code)
36 os.Setenv("PRYBAR_EXEC", config.Code)
31 os.Setenv("PRYBAR_PS1", config.Ps1)
37 os.Setenv("PRYBAR_PS1", config.Ps1)
@@ -45,18 +51,22 @@ func Execute(config *utils.Config) {
47 if !(config.Interactive || config.OurInteractive) {
53 if !(config.Interactive || config.OurInteractive) {
48− fmt.Fprintln(os.Stderr, "prybar-elisp: warn: non-interactive mode not implemented");
54+ fmt.Fprintln(os.Stderr, "prybar-elisp: warn: non-interactive mode not implemented")
51 if config.Ps2 != "... " {
57 if config.Ps2 != "... " {
52− fmt.Fprintln(os.Stderr, "prybar-elisp: warn: ps2 not implemented");
58+ fmt.Fprintln(os.Stderr, "prybar-elisp: warn: ps2 not implemented")
55− args := []string{"emacs", "-nw", "-Q", "--load", replPath, "--eval", "(prybar-repl)"}
61+ path, err := exec.LookPath(args[0])
56− err = syscall.Exec(emacs, args, os.Environ())
62+ if err != nil {
63+ fmt.Fprintf(os.Stderr, "%s: command not found\n", args[0])
66+ err = syscall.Exec(path, args, os.Environ())
58 if err != nil {
67 if err != nil {
59− panic(err)
68+ fmt.Fprintf(os.Stderr, "failed to exec %s: %s\n", path, err)