8000 Enhanced search by havocesp · Pull Request #7 · havocesp/patool · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Enhanced search #7

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions patoolib/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1040,9 +1040,9 @@ def _search_archive(
raise util.PatoolError(msg)
tmpdir = fileutil.tmpdir()
try:
path = _extract_archive(archive, outdir=tmpdir, verbosity=-1, password=password)
path = _extract_archive(archive, outdir=tmpdir, verbosity=-1, password=password)
return util.run_checked(
[grep, "-r", "-e", pattern, "."], ret_ok=(0, 1), verbosity=1, cwd=path
[grep, *shlex.split(pattern), '.'], ret_ok=(0, 1), verbosity=1, cwd=path
)
finally:
fileutil.rmtree(tmpdir)
Expand Down
4 changes: 2 additions & 2 deletions tests/test_search.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,15 @@ class ArchiveSearchTest(unittest.TestCase):
@needs_program('tar')
def test_search_tar(self):
"""Run cli function to search in TAR archive."""
pattern = "42"
pattern = "-R -P '[42]'"
archive = os.path.join(datadir, "t.tar")
self.search(pattern, archive)

@needs_program('grep')
@needs_program('unzip')
def test_search_zip(self):
"""Run cli function to search in ZIP archive."""
pattern = "42"
pattern = "--color=never -R -e 42"
archive = os.path.join(datadir, "t.zip")
self.search(pattern, archive)

Expand Down
0