Skip to content

Commit

Permalink
Fix jmeter path issue
Browse files Browse the repository at this point in the history
  • Loading branch information
leelaprasadv authored Nov 18, 2023
1 parent 8b9a385 commit e129ee2
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
5 changes: 4 additions & 1 deletion hamster/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,7 @@

jmeter_plist = f"/Users/{username}/Library/Preferences/org.apache.jmeter.plist"
jmeter_home = config_parser.get('JMETER', 'HOME')
jmeter_path = jmeter_home + '/bin/jmeter'


def jmeter_path():
return jmeter_home + '/bin/jmeter'
7 changes: 4 additions & 3 deletions hamster/menu.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ def __init__(self, title):
super(DynamicMenuApp, self).__init__(title, icon=icon_path, quit_button='Quit')
self.menu = ['Launch JMeter', 'Recent Test Plans', None, 'View Config', 'Edit JMETER_HOME', None,
'Refresh', 'Help', 'About']
prechecks(jmeter_plist, jmeter_home, jmeter_path)
self.jmeter_path = jmeter_path()
prechecks(jmeter_plist, jmeter_home, self.jmeter_path)
self.refresh_test_plans(delay=1)

def refresh_test_plans(self, delay=5):
Expand Down Expand Up @@ -100,7 +101,7 @@ def menu_callback(self, sender):
Callback function for menu items.
"""
try:
subprocess.Popen([jmeter_path, '-t', sender.title], stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
subprocess.Popen([self.jmeter_path, '-t', sender.title], stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
self.refresh_test_plans()
except Exception as e:
rumps.alert("Error", e)
Expand All @@ -111,7 +112,7 @@ def just_jmeter(self, _):
Launches JMeter without any test plan.
"""
try:
subprocess.Popen([jmeter_path], stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
subprocess.Popen([self.jmeter_path], stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
except Exception as e:
rumps.alert("Error", e)

Expand Down

0 comments on commit e129ee2

Please sign in to comment.