mirror of
https://github.com/ArchiveBox/ArchiveBox
synced 2024-11-24 21:23:22 +00:00
fix: make oneshot command return successful exist code
This commit is contained in:
parent
32eef51081
commit
40c122515a
2 changed files with 34 additions and 2 deletions
|
@ -162,7 +162,7 @@ def archive_link(link: Link, overwrite: bool=False, methods: Optional[Iterable[s
|
|||
|
||||
write_link_details(link, out_dir=out_dir, skip_sql_index=False)
|
||||
|
||||
log_link_archiving_finished(link, link.link_dir, is_new, stats, start_ts)
|
||||
log_link_archiving_finished(link, out_dir or link.link_dir, is_new, stats, start_ts)
|
||||
|
||||
except KeyboardInterrupt:
|
||||
try:
|
||||
|
|
|
@ -26,3 +26,35 @@ def test_oneshot_command_saves_page_in_right_folder(tmp_path, disable_extractors
|
|||
assert not "index.sqlite3" in current_path
|
||||
assert "output.html" in items
|
||||
|
||||
def test_oneshot_command_succeeds(tmp_path, disable_extractors_dict):
|
||||
disable_extractors_dict.update({"SAVE_DOM": "true"})
|
||||
process = subprocess.run(
|
||||
[
|
||||
"archivebox",
|
||||
"oneshot",
|
||||
f"--out-dir={tmp_path}",
|
||||
"--extract=title,favicon,dom",
|
||||
"http://127.0.0.1:8080/static/example.com.html",
|
||||
],
|
||||
capture_output=True,
|
||||
env=disable_extractors_dict,
|
||||
)
|
||||
|
||||
assert process.returncode == 0
|
||||
|
||||
def test_oneshot_command_logs_archiving_finished(tmp_path, disable_extractors_dict):
|
||||
disable_extractors_dict.update({"SAVE_DOM": "true"})
|
||||
process = subprocess.run(
|
||||
[
|
||||
"archivebox",
|
||||
"oneshot",
|
||||
f"--out-dir={tmp_path}",
|
||||
"--extract=title,favicon,dom",
|
||||
"http://127.0.0.1:8080/static/example.com.html",
|
||||
],
|
||||
capture_output=True,
|
||||
env=disable_extractors_dict,
|
||||
)
|
||||
|
||||
output_str = process.stdout.decode("utf-8")
|
||||
assert "4 files" in output_str
|
||||
|
|
Loading…
Reference in a new issue