Skip to content

Commit

Permalink
Merge branch 'dev' of https://github.com/you-n-g/wan into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
you-n-g committed Jul 21, 2020
2 parents ff54ad0 + 0eb6f36 commit 326dcc9
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@ This package is under development. We will release it soon in the future.

# Installation

[fzf](https://github.com/junegunn/fzf) is required
<!-- [fzf](https://github.com/junegunn/fzf) is required -->
```shell
pip install wan # TODO: upload this to pip source
```

## config

Expand Down
2 changes: 1 addition & 1 deletion wan/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ def wait(self, pid=None, message=None, idle=False, patience=20, sleep=3):
if pid is None:
pid = get_pid_via_fzf()
if pid is None:
logger.info('No process selected')
logger.info('No process selected, You can used --pid to specify the process')
return

process_info = self._get_process_info(pid)
Expand Down
7 changes: 6 additions & 1 deletion wan/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,12 @@ def get_pid_from_line(line):


def get_pid_via_fzf(exact=True):
return get_pid_from_line(iterfzf(iter_ps(), multi=False, exact=exact))
try:
selected_line = iterfzf(iter_ps(), multi=False, exact=exact)
except PermissionError as e:
logger.error(f'Please make {e.filename} executable(e.g `chmod a+x {e.filename}`).')
return None
return get_pid_from_line(selected_line)


def is_buzy(proc: psutil.Process) -> bool:
Expand Down

0 comments on commit 326dcc9

Please sign in to comment.