diff --git a/hphp/runtime/debugger/cmd/cmd_interrupt.cpp b/hphp/runtime/debugger/cmd/cmd_interrupt.cpp index 5370d0449..226ed77ad 100644 --- a/hphp/runtime/debugger/cmd/cmd_interrupt.cpp +++ b/hphp/runtime/debugger/cmd/cmd_interrupt.cpp @@ -209,7 +209,9 @@ void CmdInterrupt::onClientImpl(DebuggerClient &client) { m_bpi->m_exceptionClass.c_str(), m_bpi->site().c_str()); client.shortCode(m_bpi); - client.output(m_bpi->m_exceptionObject); + if (client.isApiMode() || client.getLogFileHandler()) { + client.output(m_bpi->m_exceptionObject); + } } } if (!bpm->m_output.empty()) { diff --git a/hphp/runtime/debugger/cmd/cmd_list.cpp b/hphp/runtime/debugger/cmd/cmd_list.cpp index 071f59879..bd8965105 100644 --- a/hphp/runtime/debugger/cmd/cmd_list.cpp +++ b/hphp/runtime/debugger/cmd/cmd_list.cpp @@ -335,8 +335,10 @@ void CmdList::onClientImpl(DebuggerClient &client) { // The function returns false if the reply to the client fails during the // sending process. bool CmdList::onServer(DebuggerProxy &proxy) { + auto savedWarningFrequency = RuntimeOption::WarningFrequency; + RuntimeOption::WarningFrequency = 0; m_code = f_file_get_contents(m_file.c_str()); - if (!m_code && m_file[0] != '/') { + if (!proxy.isLocal() && !m_code && m_file[0] != '/') { DSandboxInfo info = proxy.getSandbox(); if (info.m_path.empty()) { raise_warning("path for sandbox %s is not setup, run a web request", @@ -346,11 +348,12 @@ bool CmdList::onServer(DebuggerProxy &proxy) { m_code = f_file_get_contents(full_path.c_str()); } } + RuntimeOption::WarningFrequency = savedWarningFrequency; return proxy.sendToClient((DebuggerCommand*)this); } // Sends a "list file" command to the proxy attached to the given client. -// Returns false if the file does not exist or could not be read or an +// Returns false if the file does not exist or could not be read as an // HPHP::String instance containing the contents of the file. Variant CmdList::GetSourceFile(DebuggerClient &client, const std::string &file) { diff --git a/hphp/runtime/debugger/cmd/cmd_quit.cpp b/hphp/runtime/debugger/cmd/cmd_quit.cpp index fff856008..aa714391f 100644 --- a/hphp/runtime/debugger/cmd/cmd_quit.cpp +++ b/hphp/runtime/debugger/cmd/cmd_quit.cpp @@ -41,12 +41,23 @@ void CmdQuit::onClientImpl(DebuggerClient &client) { if (DebuggerCommand::displayedHelp(client)) return; if (client.argCount() == 0) { - client.sendToServer(this); + client.xend(this); // Wait for server ack before closing pipe. client.quit(); } else { help(client); } } +// Sends an acknowledgment back to the client so that +// it can go ahead and terminate. It it were to do so +// before the server has received the command, the pipe +// will be closed and the proxy will carry on as if there +// were a communication failure, which is not as clean +// explicitly quitting. +bool CmdQuit::onServer(DebuggerProxy &proxy) { + TRACE(2, "CmdQuit::onServer\n"); + return proxy.sendToClient(this); +} + /////////////////////////////////////////////////////////////////////////////// }} diff --git a/hphp/runtime/debugger/cmd/cmd_quit.h b/hphp/runtime/debugger/cmd/cmd_quit.h index 39c3524f8..bae477b40 100644 --- a/hphp/runtime/debugger/cmd/cmd_quit.h +++ b/hphp/runtime/debugger/cmd/cmd_quit.h @@ -27,14 +27,11 @@ class CmdQuit : public DebuggerCommand { public: CmdQuit() : DebuggerCommand(KindOfQuit) {} - // The text to display when the debugger client processes "help quit". virtual void help(DebuggerClient &client); protected: - // Carries out the Quit command by informing the server the client - // is going away and then getting the client to quit. virtual void onClientImpl(DebuggerClient &client); - + virtual bool onServer(DebuggerProxy &proxy); }; /////////////////////////////////////////////////////////////////////////////// diff --git a/hphp/runtime/debugger/debugger_proxy.cpp b/hphp/runtime/debugger/debugger_proxy.cpp index ea8b38be5..ebc99bed6 100644 --- a/hphp/runtime/debugger/debugger_proxy.cpp +++ b/hphp/runtime/debugger/debugger_proxy.cpp @@ -625,6 +625,7 @@ void DebuggerProxy::processInterrupt(CmdInterrupt &cmd) { } if (res->is(DebuggerCommand::KindOfQuit)) { TRACE_RB(2, "Received quit command\n"); + res->onServer(*this); // acknowledge receipt so that client can quit. Debugger::RemoveProxy(shared_from_this()); forceQuit(); throw DebuggerClientExitException();