Thomas Denk wrote:
> For your reference, a few snips from my code:
>
> // this runs fine
> int SVNRunner::Checkout(const wxString& repo, const wxString& dir,
> const wxString& revision)
> {
> return Run("checkout \"" + repo + "\" \"" + dir + "\" -r " + revision);
> }
>
> // this utterly fails
But *how* does it fail? Error message? Crash?
> int TortoiseRunner::Branch(const wxString& path)
> {
> wxString cmd("/command:copy /notempfile /closeonend /path:\"");
> cmd << path << "\"";
> return Run(cmd);
> }
> // both SVNRunner and TortoiseRunner implement the virtual Run()
> function to make sure paramters are correct
> // and to handle errors, prompt for passwords if svn wants one, etc...
> and finally both call:
> int ToolRunner::Run(wxString cmd)
> {
> std_out = std_err = ""; std_out_array.Clear();
> count = 0;
> lastExitCode = 0;
>
> wxString runCommand(exec + " " + cmd);
> outputLog->AddLog(runCommand);
>
> process = new PipedProcess((void**)&process, this, ID_RUNNER);
>
> if (!wxExecute(runCommand, wxEXEC_ASYNC, process))
> {
> outputLog->AddLog("Error: Did not find the tool to launch ?");
> return -1;
> }
> runLock = true;
> while(runLock) // this is not nice, but we want all operations finished
> ::wxYield();
You're absolutely right, this is *not* nice. Please use
WaitForSingleObject or something like that, but *never* use a loop to
wait for a program to end!
(best would be to use WaitForMultipleObjects() with one timeout handle
and with the process handle).
> return lastExitCode;
> }
>
> The exec variable holds the contents of
> HKEY_LOCAL_MACHINE\SOFTWARE\TortoiseSVN\ProcPath, so
> for example "C:\Program Files\TortoiseSVN\bin\tortoiseproc.exe".
> If I set it to "cmd /C C:\Program
> Files\TortoiseSVN\bin\tortoiseproc.exe" instead, then everything is fine.
I don't know what wxExecute internally does. But if you look at
https://svn.collab.net/repos/tortoisesvn/trunk/src/TortoiseShell/ContextMenu.cpp
method CShellExt::InvokeCommand() you can see how the shell extension
part calls TortoiseProc. Maybe you can use that.
Stefan
--
___
oo // \\ "De Chelonian Mobile"
(_,\/ \_/ \ TortoiseSVN
\ \_/_\_/> The coolest Interface to (Sub)Version Control
/_/ \_\ http://tortoisesvn.tigris.org
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tortoisesvn.tigris.org
For additional commands, e-mail: dev-help@tortoisesvn.tigris.org
Received on Tue Jun 21 19:01:22 2005