Removing octant reference for now, it will need to be later embedded into the ui Working on this will require these commands to be run in the web directory: npm install npm install --save-dev electron behind a proxy npm install may have issues, this might work: npx cross-env ELECTRON_GET_USE_PROXY=true GLOBAL_AGENT_HTTPS_PROXY= http://<proxy>:<port> npm install -D electron@latest Change-Id: I5bd054a767fe8ab7b0461a16eced1921c4de11f6
43 lines
1.1 KiB
Go
Executable File
43 lines
1.1 KiB
Go
Executable File
/*
|
|
Copyright (c) 2020 AT&T. All Rights Reserved.
|
|
SPDX-License-Identifier: Apache-2.0
|
|
*/
|
|
package electron
|
|
|
|
import (
|
|
"log"
|
|
"os/exec"
|
|
"syscall"
|
|
)
|
|
|
|
// RunElectron executes the standalone electron app which serves up our web components
|
|
func RunElectron() {
|
|
cmd := exec.Command("npm", "start", "--prefix", "web")
|
|
|
|
// make sure the logs are coming out of electron app
|
|
//cmd.Stdout = os.Stdout
|
|
// cmd.Stderr = os.Stderr
|
|
|
|
if err := cmd.Run(); err != nil {
|
|
if exitError, ok := err.(*exec.ExitError); ok {
|
|
log.Fatalf("Exit with error: %v", exitError)
|
|
}
|
|
}
|
|
|
|
if err := cmd.Wait(); err != nil {
|
|
if exiterr, ok := err.(*exec.ExitError); ok {
|
|
// The program has exited with an exit code != 0
|
|
|
|
// This works on both Unix and Windows. Although package
|
|
// syscall is generally platform dependent, WaitStatus is
|
|
// defined for both Unix and Windows and in both cases has
|
|
// an ExitStatus() method with the same signature.
|
|
if status, ok := exiterr.Sys().(syscall.WaitStatus); ok {
|
|
log.Printf("Exit Status: %d", status.ExitStatus())
|
|
}
|
|
} else {
|
|
log.Fatalf("Electron app close detected, exiting")
|
|
}
|
|
}
|
|
}
|