Skip to content

Commit

Permalink
Revert "revert previous work aimed at getting runSvnAsync to work on …
Browse files Browse the repository at this point in the history
…windows (will try a new approach)"

This reverts commit 3c7f0ef.

Conflicts:

	src/cpp/session/modules/SessionSVN.cpp
  • Loading branch information
jcheng5 committed Dec 24, 2011
1 parent ec7c2bf commit 3bd0551
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 28 deletions.
30 changes: 18 additions & 12 deletions src/cpp/session/modules/SessionConsoleProcess.cpp
Expand Up @@ -68,7 +68,6 @@ ConsoleProcess::ConsoleProcess()
outputBuffer_.push_back('\n');
}

#ifndef _WIN32
ConsoleProcess::ConsoleProcess(const std::string& command,
const core::system::ProcessOptions& options,
const std::string& caption,
Expand All @@ -83,7 +82,6 @@ ConsoleProcess::ConsoleProcess(const std::string& command,
{
commonInit();
}
#endif

ConsoleProcess::ConsoleProcess(const std::string& program,
const std::vector<std::string>& args,
Expand Down Expand Up @@ -123,15 +121,25 @@ void ConsoleProcess::commonInit()
// prompting works properly
options_.createNewConsole = true;

// build new args
shell_utils::ShellArgs args;
args << program_;
args << args_;

// fixup program_ and args_ so we run the consoleio.exe proxy
FilePath consoleIoPath = session::options().consoleIoPath();
program_ = consoleIoPath.absolutePathNative();
args_ = args;

// if this is as runProgram then fixup the program and args
if (!program_.empty())
{
// build new args
shell_utils::ShellArgs args;
args << program_;
args << args_;

// fixup program_ and args_ so we run the consoleio.exe proxy
program_ = consoleIoPath.absolutePathNative();
args_ = args;
}
// if this is a runCommand then prepend consoleio.exe to the command
else
{
command_ = shell_utils::escape(consoleIoPath) + " " + command_;
}
#else
// request a pseudoterminal if this is an interactive console process
options_.pseudoterminal = core::system::Pseudoterminal(80, 1);
Expand Down Expand Up @@ -534,7 +542,6 @@ Error procWriteStdin(const json::JsonRpcRequest& request,
}
}

#ifndef _WIN32
boost::shared_ptr<ConsoleProcess> ConsoleProcess::create(
const std::string& command,
core::system::ProcessOptions options,
Expand All @@ -554,7 +561,6 @@ boost::shared_ptr<ConsoleProcess> ConsoleProcess::create(
s_procs[ptrProc->handle()] = ptrProc;
return ptrProc;
}
#endif

boost::shared_ptr<ConsoleProcess> ConsoleProcess::create(
const std::string& program,
Expand Down
4 changes: 0 additions & 4 deletions src/cpp/session/modules/SessionConsoleProcess.hpp
Expand Up @@ -50,15 +50,13 @@ class ConsoleProcess : boost::noncopyable,
// suspend/resume scenarios)
ConsoleProcess();

#ifndef _WIN32
ConsoleProcess(
const std::string& command,
const core::system::ProcessOptions& options,
const std::string& caption,
bool dialog,
InteractionMode mode,
int maxOutputLines);
#endif

ConsoleProcess(
const std::string& program,
Expand Down Expand Up @@ -94,15 +92,13 @@ class ConsoleProcess : boost::noncopyable,
// Win32 because in order to implement the InteractionPossible/Always
// modes we use the consoleio.exe proxy, which can only be invoked from
// the runProgram codepath
#ifndef _WIN32
static boost::shared_ptr<ConsoleProcess> create(
const std::string& command,
core::system::ProcessOptions options,
const std::string& caption,
bool dialog,
InteractionMode mode,
int maxOutputLines = kDefaultMaxOutputLines);
#endif

static boost::shared_ptr<ConsoleProcess> create(
const std::string& program,
Expand Down
19 changes: 7 additions & 12 deletions src/cpp/session/modules/SessionSVN.cpp
Expand Up @@ -149,7 +149,6 @@ void maybeAttachPasswordManager(boost::shared_ptr<ConsoleProcess> pCP)
s_pPasswordManager->attach(pCP);
}

#ifndef _WIN32
ShellCommand svn()
{
if (!s_svnExePath.empty())
Expand All @@ -160,7 +159,6 @@ ShellCommand svn()
else
return ShellCommand("svn");
}
#endif


#ifdef _WIN32
Expand Down Expand Up @@ -256,27 +254,24 @@ core::Error createConsoleProc(const ShellArgs& args,
else if (!workingDir.get().empty())
options.workingDir = workingDir.get();

#ifdef _WIN32
*ppCP = ConsoleProcess::create(svnBin(),
args.args(),
options,
caption,
dialog,
console_process::InteractionPossible,
console_process::kDefaultMaxOutputLines);
#else
// NOTE: we use runCommand style process creation on both windows and posix
// so that we can redirect standard output to a file -- this works on
// windows because we are not specifying options.detachProcess (not
// necessary because ConsoleProcess specifies options.createNewConsole
// which overrides options.detachProcess)

// build command (redirect stdout to a file)
std::string command = svn() << args.args();
if (!outputFile.empty())
command = "(" + command + ")" + " > " + shell_utils::escape(outputFile);

// create the process
*ppCP = ConsoleProcess::create(command,
options,
caption,
dialog,
console_process::InteractionPossible,
console_process::kDefaultMaxOutputLines);
#endif

if (enqueueRefreshOnExit)
(*ppCP)->onExit().connect(boost::bind(&enqueueRefreshEvent));
Expand Down

0 comments on commit 3bd0551

Please sign in to comment.