Change path type to str in fs utils remove command and fix for '*' at the
end of given path Signed-off-by: Katarzyna Treder <katarzyna.treder@h-partners.com>
This commit is contained in:
parent
96d7241423
commit
452000c03c
@ -125,8 +125,12 @@ def move(source, destination, force: bool = False):
|
|||||||
return TestRun.executor.run_expect_success(cmd)
|
return TestRun.executor.run_expect_success(cmd)
|
||||||
|
|
||||||
|
|
||||||
def remove(path, force: bool = False, recursive: bool = False, ignore_errors: bool = False):
|
def remove(path: str, force: bool = False, recursive: bool = False, ignore_errors: bool = False):
|
||||||
cmd = f"rm{' --force' if force else ''}{' --recursive' if recursive else ''} \"{path}\""
|
cmd = "rm"
|
||||||
|
cmd += " --force" if force else ""
|
||||||
|
cmd += " --recursive" if recursive else ""
|
||||||
|
cmd += f" \"{path}\"" if not path.endswith("*") else f" \"{path[:-1]}\"*"
|
||||||
|
|
||||||
output = TestRun.executor.run(cmd)
|
output = TestRun.executor.run(cmd)
|
||||||
if output.exit_code != 0 and not ignore_errors:
|
if output.exit_code != 0 and not ignore_errors:
|
||||||
raise Exception(f"Could not remove file {path}."
|
raise Exception(f"Could not remove file {path}."
|
||||||
|
Loading…
Reference in New Issue
Block a user