Skip to content

Commit

Permalink
fix error handling
Browse files Browse the repository at this point in the history
  • Loading branch information
tkmru committed Sep 5, 2020
1 parent 5e2db5b commit 3526d74
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
4 changes: 4 additions & 0 deletions idapm/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,12 @@ def cmd_init(args):
print('----------------------')
try:
repo_url = 'https://github.com/{0}.git'.format(repo_name)
print('Try: git clone {0}'.format(repo_url))
installer.install_from_github(plugin, repo_url)

except:
repo_url = '[email protected]:{0}.git'.format(repo_name)
print('Try: git clone {0}'.format(repo_url))
installer.install_from_github(plugin, repo_url)
break

Expand All @@ -64,11 +66,13 @@ def cmd_install(args):

print('----------------------')
repo_https_url = 'https://github.com/{0}.git'.format(args.plugin_name)
print('Try: git clone {0}'.format(repo_https_url))
if installer.install_from_github(args.plugin_name, repo_https_url):
c.add_plugin(args.plugin_name)

else:
repo_ssh_url = '[email protected]:{0}.git'.format(args.plugin_name)
print('Try: git clone {0}'.format(repo_ssh_url))
if installer.install_from_github(args.plugin_name, repo_ssh_url):
c.add_plugin(args.plugin_name)

Expand Down
2 changes: 1 addition & 1 deletion idapm/installer.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ def install_from_github(repo_name, repo_url):
if (errs is not None) and (len(errs) != 0):
msg = errs.decode('ascii').replace('\n', '')
print(msg)
if 'Repository not found' in msg:
if ('Repository not found' in msg) or ('already exists and is not an empty directory' in msg):
return False

py_file_list = glob.glob(os.path.join(installed_path, '**/*.py'), recursive=True)
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

setup(
name="idapm",
version="0.0.1",
version="0.1.0",
description="IDA Plugin Manager",
author="tkmru",
packages=['idapm'],
Expand Down

0 comments on commit 3526d74

Please sign in to comment.