示例#1
0
Error runSvn(const ShellArgs& args,
             const FilePath& workingDir,
             bool redirectStdErrToStdOut,
             core::system::ProcessResult* pResult)
{
   core::system::ProcessOptions options = procOptions();
   if (!workingDir.empty())
      options.workingDir = workingDir;
   options.redirectStdErrToStdOut = redirectStdErrToStdOut;
   Error error = core::system::runCommand(svn() << args.args(),
                                          options,
                                          pResult);
   return error;
}
示例#2
0
core::Error createConsoleProc(const ShellArgs& args,
                              const FilePath& outputFile,
                              const boost::optional<FilePath>& workingDir,
                              const std::string& caption,
                              bool requiresSsh,
                              bool dialog,
                              bool enqueueRefreshOnExit,
                              boost::shared_ptr<ConsoleProcess>* ppCP)
{
   core::system::ProcessOptions options = procOptions(requiresSsh);
   if (!workingDir)
      options.workingDir = s_workingDir;
   else if (!workingDir.get().empty())
      options.workingDir = workingDir.get();

   // 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
   std::string command = svn() << args.args();

   // redirect stdout to a file
   if (!outputFile.empty())
      options.stdOutFile = outputFile;

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

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

   return Success();
}