Skip to content

Commit

Permalink
馃敤 Return subprocess.Popen on launch (#11)
Browse files Browse the repository at this point in the history
* 馃敤 Return subprocess.Popen on launch

* Return None explicitly
  • Loading branch information
roniemartinez committed Apr 23, 2022
1 parent a74ea94 commit 8550e12
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
10 changes: 5 additions & 5 deletions browsers/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def get(browser: str) -> Optional[Dict]:
return None


def launch(browser: str, url: str = None, args: Optional[Sequence[str]] = None) -> None:
def launch(browser: str, url: str = None, args: Optional[Sequence[str]] = None) -> Optional[subprocess.Popen]:
"""
Launches a web browser.
Expand All @@ -60,11 +60,11 @@ def launch(browser: str, url: str = None, args: Optional[Sequence[str]] = None)
b = get(browser)
if not b:
logger.info("Cannot find browser '%s'", browser)
return
_launch(browser, b["path"], args, url)
return None
return _launch(browser, b["path"], args, url)


def _launch(browser: str, path: str, args: Sequence[str], url: str = None) -> None: # pragma: no cover
def _launch(browser: str, path: str, args: Sequence[str], url: str = None) -> subprocess.Popen: # pragma: no cover
url_arg = []

if browser == "firefox" and url is not None:
Expand All @@ -80,4 +80,4 @@ def _launch(browser: str, path: str, args: Sequence[str], url: str = None) -> No
if sys.platform == "darwin":
command = ["open", "--wait-apps", "--new", "--fresh", "-a", *command]

subprocess.Popen(command)
return subprocess.Popen(command)
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "pybrowsers"
version = "0.1.0"
version = "0.2.0"
repository = "https://github.com/roniemartinez/browsers"
description = "Python library for detecting and launching browsers"
authors = ["Ronie Martinez <ronmarti18@gmail.com>"]
Expand Down

0 comments on commit 8550e12

Please sign in to comment.