Skip to content

Commit df71def

Browse files
committed
fix library-specific error messages to not appear with modules
1 parent 7fe237a commit df71def

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

lib/msf/ui/console/command_dispatcher/modules.rb

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -77,9 +77,11 @@ def cmd_edit_help
7777
# Edit the currently active module or a local file
7878
#
7979
def cmd_edit(*args)
80+
editing_module = false
8081
if args.length > 0
8182
path = args[0]
8283
elsif active_module
84+
editing_module = true
8385
path = active_module.file_path
8486
end
8587

@@ -95,14 +97,16 @@ def cmd_edit(*args)
9597
system(*editor.split, path)
9698

9799
# XXX: This will try to reload *any* .rb and break on modules
98-
if args.length > 0 && path.end_with?('.rb')
99-
print_status("Reloading #{path}")
100-
load path
101-
else
102-
print_error('Only Ruby files can be reloaded (use reload/rerun for modules)')
100+
if !editing_module
101+
if path.end_with?('.rb')
102+
print_status("Reloading #{path}")
103+
load path
104+
else
105+
print_error("Only library files can be reloaded after editing (use reload/rerun for modules)")
106+
end
103107
end
104108
else
105-
print_error('Nothing to edit -- try using a module first.')
109+
print_error('Nothing to edit -- try using a module first, or specifying a library file to edit.')
106110
end
107111
end
108112

0 commit comments

Comments
 (0)