Skip to content

Commit c76b249

Browse files
committed
Also open the URL in a browser when running Flask applications
1 parent e5a536e commit c76b249

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

Diff for: v2/build.go

+7
Original file line numberDiff line numberDiff line change
@@ -1330,6 +1330,13 @@ func (e *Editor) Build(c *vt100.Canvas, status *StatusBar, tty *vt100.TTY) {
13301330
case mode.JavaScript, mode.Lua, mode.Python, mode.Shell, mode.TypeScript:
13311331
if e.flaskApplication.Load() {
13321332
msg = "Serving Flask on http://127.0.0.1:5000/ ..."
1333+
var cmd *exec.Cmd
1334+
if isDarwin {
1335+
cmd = exec.Command("open", "http://127.0.0.1:5000")
1336+
} else {
1337+
cmd = exec.Command("xdg-open", "http://127.0.0.1:5000")
1338+
}
1339+
cmd.Run()
13331340
} else {
13341341
msg = "Running..."
13351342
}

0 commit comments

Comments
 (0)