PR comments
This commit is contained in:
parent
269ace1d1c
commit
8b453eae9a
3 changed files with 5 additions and 5 deletions
|
|
@ -122,7 +122,7 @@ func run(ctx context.Context, ms *xmain.State) (err error) {
|
||||||
defer func() {
|
defer func() {
|
||||||
cleanupErr := pw.Cleanup()
|
cleanupErr := pw.Cleanup()
|
||||||
if cleanupErr != nil {
|
if cleanupErr != nil {
|
||||||
ms.Log.Error.Printf("error cleaning up playwright: %v", cleanupErr.Error())
|
ms.Log.Error.Printf("error cleaning up Playwright: %v", cleanupErr.Error())
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -332,7 +332,7 @@ func (w *watcher) compileLoop(ctx context.Context) error {
|
||||||
if filepath.Ext(w.outputPath) == ".png" && !w.pw.Browser.IsConnected() {
|
if filepath.Ext(w.outputPath) == ".png" && !w.pw.Browser.IsConnected() {
|
||||||
newPW, err := w.pw.RestartBrowser()
|
newPW, err := w.pw.RestartBrowser()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("playwright could not be restarted: %w", err)
|
return fmt.Errorf("Playwright could not be restarted: %w", err)
|
||||||
}
|
}
|
||||||
w.pw = newPW
|
w.pw = newPW
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -73,7 +73,7 @@ func InitPlaywright() (Playwright, error) {
|
||||||
cmd := exec.Command(driver.DriverBinaryLocation, "--version")
|
cmd := exec.Command(driver.DriverBinaryLocation, "--version")
|
||||||
output, err := cmd.Output()
|
output, err := cmd.Output()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return Playwright{}, fmt.Errorf("error getting playwright version: %w\nplease report this issue here: https://github.com/terrastruct/d2/issues/new", err)
|
return Playwright{}, fmt.Errorf("error getting Playwright version: %w\nplease report this issue here: https://github.com/terrastruct/d2/issues/new", err)
|
||||||
}
|
}
|
||||||
if !bytes.Contains(output, []byte(driver.Version)) {
|
if !bytes.Contains(output, []byte(driver.Version)) {
|
||||||
err = playwright.Install()
|
err = playwright.Install()
|
||||||
|
|
@ -82,7 +82,7 @@ func InitPlaywright() (Playwright, error) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
return Playwright{}, fmt.Errorf("could not access playwright binary location: %w\nplease report this issue here: https://github.com/terrastruct/d2/issues/new", err)
|
return Playwright{}, fmt.Errorf("could not access Playwright binary location: %v\nerror: %w\nplease report this issue here: https://github.com/terrastruct/d2/issues/new", driver.DriverBinaryLocation, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
pw, err := playwright.Run()
|
pw, err := playwright.Run()
|
||||||
|
|
@ -97,7 +97,7 @@ var genPNGScript string
|
||||||
|
|
||||||
func ExportPNG(ms *xmain.State, page playwright.Page, svg []byte) (outputImage []byte, err error) {
|
func ExportPNG(ms *xmain.State, page playwright.Page, svg []byte) (outputImage []byte, err error) {
|
||||||
if page == nil {
|
if page == nil {
|
||||||
return nil, fmt.Errorf("playwright was not initialized properly\nplease report this issue here: https://github.com/terrastruct/d2/issues/new")
|
return nil, fmt.Errorf("Playwright was not initialized properly\nplease report this issue here: https://github.com/terrastruct/d2/issues/new")
|
||||||
}
|
}
|
||||||
|
|
||||||
encodedSVG := base64.StdEncoding.EncodeToString(svg)
|
encodedSVG := base64.StdEncoding.EncodeToString(svg)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue