Skip to content

Commit af8e56a

Browse files
authored
Merge pull request #3023 from input-output-hk/chore/manus-webdriver-mocha-setup--better-darwin-launcher
[DDW-1122] Fix `darwin-launcher.go` to replace its process image with `cardano-launcher` (binary), and not swallow `stdout`
2 parents d8a96ec + 24991f6 commit af8e56a

File tree

2 files changed

+19
-6
lines changed

2 files changed

+19
-6
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
### Chores
1111

12+
- Fix `darwin-launcher.go` to replace its process image with `cardano-launcher` (binary), and not swallow `stdout` ([PR 3023](https://github.com/input-output-hk/daedalus/pull/3023))
1213
- Updated cardano-node to 1.35.1 ([PR 3012](https://github.com/input-output-hk/daedalus/pull/3012))
1314

1415
### Features

nix/darwin-launcher.go

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,12 @@ import (
55
"os"
66
"os/exec"
77
"path/filepath"
8+
"syscall"
89
)
910

1011
func main() {
12+
fmt.Fprintf(os.Stderr, "darwin-launcher: PID = %d\n", os.Getpid())
13+
1114
ex, err := os.Executable()
1215
if err != nil {
1316
panic(err)
@@ -17,14 +20,23 @@ func main() {
1720

1821
os.Setenv("PATH", fmt.Sprintf("%s:%s", installDir, os.Getenv("PATH")))
1922

20-
launcherConfig := filepath.Join(installDir, "../Resources/launcher-config.yaml")
21-
helper := filepath.Join(installDir, "../Resources/helper")
22-
23+
launcherConfigPath := filepath.Join(installDir, "../Resources/launcher-config.yaml")
24+
helperPath := filepath.Join(installDir, "../Resources/helper")
2325

24-
if err = exec.Command(helper).Run(); err != nil {
26+
helperCmd := exec.Command(helperPath)
27+
helperCmd.Stdout = os.Stdout
28+
helperCmd.Stderr = os.Stderr
29+
if err := helperCmd.Run(); err != nil {
2530
panic(err)
2631
}
27-
if err = exec.Command("cardano-launcher", "--config", launcherConfig).Run(); err != nil {
28-
panic(err)
32+
33+
// Replace the current process (otherwise WDIO complains in end-to-end tests):
34+
img := filepath.Join(installDir, "cardano-launcher")
35+
argv := []string{"cardano-launcher", "--config", launcherConfigPath}
36+
env := os.Environ()
37+
if err := syscall.Exec(img, argv, env); err != nil {
38+
fmt.Println(err)
2939
}
40+
41+
fmt.Fprintf(os.Stderr, "this won’t happen\n")
3042
}

0 commit comments

Comments
 (0)