mirror of
https://github.com/ARM-software/workload-automation.git
synced 2025-02-07 21:51:33 +00:00
listdir on Linux: return empty list for an empty directory
Previously, was returning a list with a single empty string element
This commit is contained in:
parent
26dee81164
commit
4904c6cf71
@ -719,7 +719,9 @@ class LinuxDevice(BaseLinuxDevice):
|
|||||||
return boolean(output.split()[-1]) # pylint: disable=maybe-no-member
|
return boolean(output.split()[-1]) # pylint: disable=maybe-no-member
|
||||||
|
|
||||||
def listdir(self, path, as_root=False, **kwargs):
|
def listdir(self, path, as_root=False, **kwargs):
|
||||||
contents = self.execute('ls -1 {}'.format(path), as_root=as_root)
|
contents = self.execute('ls -1 {}'.format(path), as_root=as_root).strip()
|
||||||
|
if not contents:
|
||||||
|
return []
|
||||||
return [x.strip() for x in contents.split('\n')] # pylint: disable=maybe-no-member
|
return [x.strip() for x in contents.split('\n')] # pylint: disable=maybe-no-member
|
||||||
|
|
||||||
def install(self, filepath, timeout=default_timeout, with_name=None): # pylint: disable=W0221
|
def install(self, filepath, timeout=default_timeout, with_name=None): # pylint: disable=W0221
|
||||||
|
Loading…
x
Reference in New Issue
Block a user