-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
10 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,20 @@ | ||
import subprocess | ||
from ..utils.error_logging import print_please_install_betty | ||
|
||
|
||
def betty_check(file_path): | ||
try: | ||
result = subprocess.run(["betty", file_path]) | ||
except Exception: | ||
print_please_install_betty() | ||
return False | ||
# because it have different ouput meaning looking for errors | ||
try: | ||
result1 = subprocess.run(["betty", file_path], check=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) | ||
except subprocess.CalledProcessError as e: | ||
return False | ||
|
||
if "ERROR:" in result1.stdout or "ERROR:" in result1.stderr: | ||
return False | ||
|
||
return result.returncode == 0 | ||
|