Correctly handle the readline threading issue, tested with sessions.
git-svn-id: file:///home/svn/framework3/trunk@5541 4d416f70-5f16-0410-b530-b9f4589650daunstable
parent
d700c51e1a
commit
596a13ae30
|
@ -15,7 +15,7 @@ begin
|
|||
###
|
||||
class Input::Readline < Rex::Ui::Text::Input
|
||||
include ::Readline
|
||||
|
||||
|
||||
#
|
||||
# Initializes the readline-aware Input instance for text.
|
||||
#
|
||||
|
@ -74,14 +74,19 @@ begin
|
|||
# receives, massively slowing down the entire framework.
|
||||
#
|
||||
def pgets
|
||||
|
||||
if(true)
|
||||
|
||||
if(Rex::Compat.is_windows())
|
||||
output.prompting
|
||||
line = ::Readline.readline(prompt, true)
|
||||
HISTORY.pop if (line and line.empty?)
|
||||
return line
|
||||
end
|
||||
|
||||
|
||||
# Wrap readline in a child process and secure with a mutex
|
||||
# This prevents threading hangs in the calling process.
|
||||
require "thread"
|
||||
@@child_mutex ||= Mutex.new
|
||||
@@child_mutex.synchronize do
|
||||
|
||||
output.prompting
|
||||
|
||||
|
@ -112,6 +117,9 @@ begin
|
|||
eof = true
|
||||
return line
|
||||
end
|
||||
|
||||
# Release the readline mutex
|
||||
end
|
||||
end
|
||||
|
||||
#
|
||||
|
|
Loading…
Reference in New Issue