svn and wscript

View: New views
9 Messages — Rating Filter:   Alert me  

svn and wscript

by Luke Mason :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Some parts of this message have been removed. Learn more about Nabble's security policy.

Hi,

 

I’m trying to integrate subversion into our build process.  We have a ticketing system that we also use to list associated sql files to that allows us to specify their apply order. We have a script that gets all tickets for a build, all associated sql, in order.  Their source may be one of several places, and will include SVN. 

 

SVN_REMOTE is our svn server, served over http. 

SVN_LOCAL is where the working copy should be (d:\build\svn_wc). 

 

runCmd is used to execute the commandline, catching output and shooting it through to the log.  When this is run, I end up hanging.  The directory structure is created, including a .svn dir, but no files.  When I cancel the batch job, all the files are then created (but my batch is dead, so no good to me).  I have also tried it with cmd /c in front of the command – didn’t appear to work.  Runcmd however works quite well for other commands.

 

Before anyone asks, yes, it has to be run in windows. No, I don’t have time to learn python. 

svn, version 1.6.3 (r38063) (so not very far behind)

 

To checkout the directory containing an sql file I need, I run:

Function ProcessSVNFile(filename, svn_filepath)

                Debug("Function: ProcessSVNFile")

                'remove the remote prefix for the svn repos, replace it with the path to the local working copy, then swap the slashes.

                Dim local_path

                Dim cmd

                Dim return_code

               

                local_path = replace(replace(svn_filepath, SVN_REMOTE, SVN_LOCAL), "/", "\")

                cmd ="svn checkout --force --depth files --username xxxx --password xxxx --non-interactive " & svn_filepath & " " & local_path

                ‘debug("Command: " & cmd)

                return_code = runCmd(cmd, "Get SVN File Directory")

                if return_code <> 0 then

                                Log "Failure: Could not checkout " & filename, "Error Code: " & return_code, LOG_FAIL

                else

                                Log "Success: Checked out " & filename, "", LOG_NORMAL

                end if

               

                Log "Info: " & local_path, "", LOG_NORMAL

                if not fso.FileExists(local_path & filename) then

                                Log "Failure: File " & filename & " does not exist at " & local_path, "", LOG_FAIL

                else

                                Log "Success: File " & filename & " exists", "", LOG_NORMAL

                end if

                ProcessSVNFile = local_path & filename

End Function

 

' generic function to run a command and log the standard output.

' returns the exit code.

Function runCmd(cmd, msg)

                debug("Function: runCmd: " & msg)

                Dim objShell

                Dim objExecObject

                Dim strText

                Set objShell = WScript.CreateObject("WScript.Shell")

                Set objExecObject = objShell.Exec(cmd)

 

                ' wait for it to finish

                do while objExecObject.Status = 0

                                WScript.Sleep 100

                loop

 

                LogSectionOpen "runCmd"

                do while not objExecObject.StdOut.AtEndOfStream

                                strText = objExecObject.StdOut.ReadLine()

                                Log strText, "", LOG_NORMAL

                loop

                LogSectionClose "runCmd"

                runCmd = objExecObject.ExitCode

                Set objExecObject = Nothing

End Function

 

Regards,

 

Luke


"This email is intended for the named recipient only. The information contained in this message may be confidential, or commercially sensitive. If you are not the intended recipient you must not reproduce or distribute any part of this email, disclose its contents to any other party, or take any action in reliance on it, or in reference to it. If you have received this email in error, would you please contact the sender immediately and delete/destroy all copies of this message, both electronic and otherwise. It is the recipient's duty to virus scan and otherwise test the enclosed information before using the information or loading attached files onto any computer system. Oasis Asset Management Ltd does not warrant that the information contained in this e-mail is free from viruses, defects, errors, interception or interference. Any views expressed in this message are those of the individual sender, except where that sender specifically states them to be the views of Oasis Asset Management Ltd."

______________________________________________________________________
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email
______________________________________________________________________

Re: svn and wscript

by Ulrich Eckhardt :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Friday 06 November 2009, Luke Mason wrote:
> I'm trying to integrate subversion into our build process.
[...]
> runCmd is used to execute the commandline, catching output and shooting
> it through to the log.  When this is run, I end up hanging.  The
> directory structure is created, including a .svn dir, but no files.
> When I cancel the batch job, all the files are then created (but my
> batch is dead, so no good to me).

I'm guessing: svn.exe is trying to write to stdout, but its output buffer is
full, so it waits. Then, you cancel the batch job, so any pending output is
discarded but at least it allows svn.exe to continue running.

> Function runCmd(cmd, msg)
>                 debug("Function: runCmd: " & msg)
>                 Dim objShell
>                 Dim objExecObject
>                 Dim strText
>                 Set objShell = WScript.CreateObject("WScript.Shell")
>                 Set objExecObject = objShell.Exec(cmd)
>
>                 ' wait for it to finish
>                 do while objExecObject.Status = 0
>                         WScript.Sleep 100
>                 loop
>
>                 LogSectionOpen "runCmd"
>                 do while not objExecObject.StdOut.AtEndOfStream
>                         strText = objExecObject.StdOut.ReadLine()
>                         Log strText, "", LOG_NORMAL
>                 loop

While waiting for the process to finish, you need to pump its output to the
log already.

BTW, you are discarding any output to stderr, I think. Try using

  svn.exe ... 2>&1

for the commandline or mabe use objExecObject.StdErr (if that exists, I don't
actually know wscript).

Good luck!

Uli

--
ML: http://subversion.tigris.org/mailing-list-guidelines.html
FAQ: http://subversion.tigris.org/faq.html
Docs: http://svnbook.red-bean.com/

Sator Laser GmbH, Fangdieckstraße 75a, 22547 Hamburg, Deutschland
Geschäftsführer: Thorsten Föcking, Amtsgericht Hamburg HR B62 932

**************************************************************************************
Sator Laser GmbH, Fangdieckstraße 75a, 22547 Hamburg, Deutschland
Geschäftsführer: Thorsten Föcking, Amtsgericht Hamburg HR B62 932
**************************************************************************************
           Visit our website at <http://www.satorlaser.de/>
**************************************************************************************
Diese E-Mail einschließlich sämtlicher Anhänge ist nur für den Adressaten bestimmt und kann vertrauliche Informationen enthalten. Bitte benachrichtigen Sie den Absender umgehend, falls Sie nicht der beabsichtigte Empfänger sein sollten. Die E-Mail ist in diesem Fall zu löschen und darf weder gelesen, weitergeleitet, veröffentlicht oder anderweitig benutzt werden.
E-Mails können durch Dritte gelesen werden und Viren sowie nichtautorisierte Änderungen enthalten. Sator Laser GmbH ist für diese Folgen nicht verantwortlich.
**************************************************************************************

------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=1065&dsMessageId=2415070

To unsubscribe from this discussion, e-mail: [users-unsubscribe@...].

Re: svn and wscript

by brm-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Some parts of this message have been removed. Learn more about Nabble's security policy.
I integrated SVN into our build process using WSH/jscript, and the official CollabNet releases of SVN. (CollabNet adds registry entries for where SVN is installed, so it is helpful. I'd use the non-CollabNet version if the installer did that. Both are basically the same otherwise.)

I have found that is it most helpful to run the scripts from the command-line to figure out problems as you may get some details you won't get by just running it. I also tried to redirect all output into a log file so I could capture as much of any problem as possible. This will likely give you the actual problem you are encountering. It's not likely with your code below - it's likely the software is generating an error that you can't recover from in this manner.

Also you need to be aware that running SVN from the command-line does have some limitations last I was aware as it doesn't use the Windows Unicode APIs for accessing files. So path depths could be an issue.

HTH,

Ben


From: Luke Mason <lmason@...>
To: users@...
Sent: Thu, November 5, 2009 11:32:31 PM
Subject: svn and wscript

Hi,

 

I’m trying to integrate subversion into our build process.  We have a ticketing system that we also use to list associated sql files to that allows us to specify their apply order. We have a script that gets all tickets for a build, all associated sql, in order.  Their source may be one of several places, and will include SVN. 

 

SVN_REMOTE is our svn server, served over http. 

SVN_LOCAL is where the working copy should be (d:\build\svn_wc). 

 

runCmd is used to execute the commandline, catching output and shooting it through to the log.  When this is run, I end up hanging.  The directory structure is created, including a .svn dir, but no files.  When I cancel the batch job, all the files are then created (but my batch is dead, so no good to me).  I have also tried it with cmd /c in front of the command – didn’t appear to work.  Runcmd however works quite well for other commands.

 

Before anyone asks, yes, it has to be run in windows. No, I don’t have time to learn python. 

svn, version 1.6.3 (r38063) (so not very far behind)

 

To checkout the directory containing an sql file I need, I run:

Function ProcessSVNFile(filename, svn_filepath)

                Debug("Function: ProcessSVNFile")

                'remove the remote prefix for the svn repos, replace it with the path to the local working copy, then swap the slashes.

                Dim local_path

                Dim cmd

                Dim return_code

               

                local_path = replace(replace(svn_filepath, SVN_REMOTE, SVN_LOCAL), "/", "\")

                cmd ="svn checkout --force --depth files --username xxxx --password xxxx --non-interactive " & svn_filepath & " " & local_path

                ‘debug("Command: " & cmd)

                return_code = runCmd(cmd, "Get SVN File Directory")

                if return_code <> 0 then

                                Log "Failure: Could not checkout " & filename, "Error Code: " & return_code, LOG_FAIL

                else

                                Log "Success: Checked out " & filename, "", LOG_NORMAL

                end if

               

                Log "Info: " & local_path, "", LOG_NORMAL

                if not fso.FileExists(local_path & filename) then

                                Log "Failure: File " & filename & " does not exist at " & local_path, "", LOG_FAIL

                else

                                Log "Success: File " & filename & " exists", "", LOG_NORMAL

                end if

                ProcessSVNFile = local_path & filename

End Function

 

' generic function to run a command and log the standard output.

' returns the exit code.

Function runCmd(cmd, msg)

                debug("Function: runCmd: " & msg)

                Dim objShell

                Dim objExecObject

                Dim strText

                Set objShell = WScript.CreateObject("WScript.Shell")

                Set objExecObject = objShell.Exec(cmd)

 

                ' wait for it to finish

                do while objExecObject.Status = 0

                                WScript.Sleep 100

                loop

 

                LogSectionOpen "runCmd"

                do while not objExecObject.StdOut.AtEndOfStream

                                strText = objExecObject.StdOut.ReadLine()

                                Log strText, "", LOG_NORMAL

                loop

                LogSectionClose "runCmd"

                runCmd = objExecObject.ExitCode

                Set objExecObject = Nothing

End Function

 

Regards,

 

Luke


"This email is intended for the named recipient only. The information contained in this message may be confidential, or commercially sensitive. If you are not the intended recipient you must not reproduce or distribute any part of this email, disclose its contents to any other party, or take any action in reliance on it, or in reference to it. If you have received this email in error, would you please contact the sender immediately and delete/destroy all copies of this message, both electronic and otherwise. It is the recipient's duty to virus scan and otherwise test the enclosed information before using the information or loading attached files onto any computer system. Oasis Asset Management Ltd does not warrant that the information contained in this e-mail is free from viruses, defects, errors, interception or interference. Any views expressed in this message are those of the individual sender, except where that sender specifically states them to be the views of Oasis Asset Management Ltd."

______________________________________________________________________
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email
______________________________________________________________________

Re: svn and wscript

by brm-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

----- Original Message ----
From: Ulrich Eckhardt <eckhardt@...>
To: users@...
Sent: Fri, November 6, 2009 6:43:07 AM
Subject: Re: svn and wscript
> >                 LogSectionOpen "runCmd"
> >                 do while not objExecObject.StdOut.AtEndOfStream
> >                         strText = objExecObject.StdOut.ReadLine()
> >                         Log strText, "", LOG_NORMAL
> >                 loop
> While waiting for the process to finish, you need to pump its output to the
> log already.
> BTW, you are discarding any output to stderr, I think. Try using

I didn't catch this earlier - as I think there may be some other issues - but the proper
thing to do is the following:

Set objExecObject = objShell.Exec(cmd)
strText = objExecObject.StdOut.ReadAll()



I use things in a javaScript with the CollabNet build of the svn command-line client, and it works very well.
I don't have any issues with buffering at all, but I do have to read all of it .

For some reason doing the loop just doesn't work - I think WSH doesn't buffer right for that to function or something.

Ben

------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=1065&dsMessageId=2415285

To unsubscribe from this discussion, e-mail: [users-unsubscribe@...].

RE: svn and wscript

by Luke Mason :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

-----Original Message-----
From: Ulrich Eckhardt [mailto:eckhardt@...]
Sent: Friday, 6 November 2009 10:43 PM
To: users@...
Subject: Re: svn and wscript

On Friday 06 November 2009, Luke Mason wrote:
> I'm trying to integrate subversion into our build process.
[...]
> runCmd is used to execute the commandline, catching output and shooting
> it through to the log.  When this is run, I end up hanging.  The
> directory structure is created, including a .svn dir, but no files.
> When I cancel the batch job, all the files are then created (but my
> batch is dead, so no good to me).

I'm guessing: svn.exe is trying to write to stdout, but its output buffer is
full, so it waits. Then, you cancel the batch job, so any pending output is
discarded but at least it allows svn.exe to continue running.

> Function runCmd(cmd, msg)
>                 debug("Function: runCmd: " & msg)
>                 Dim objShell
>                 Dim objExecObject
>                 Dim strText
>                 Set objShell = WScript.CreateObject("WScript.Shell")
>                 Set objExecObject = objShell.Exec(cmd)
>
>                 ' wait for it to finish
>                 do while objExecObject.Status = 0
>                         WScript.Sleep 100
>                 loop
>
>                 LogSectionOpen "runCmd"
>                 do while not objExecObject.StdOut.AtEndOfStream
>                         strText = objExecObject.StdOut.ReadLine()
>                         Log strText, "", LOG_NORMAL
>                 loop

While waiting for the process to finish, you need to pump its output to the
log already.

BTW, you are discarding any output to stderr, I think. Try using

  svn.exe ... 2>&1

for the commandline or mabe use objExecObject.StdErr (if that exists, I don't
actually know wscript).

Good luck!

Uli



I'll try that Uli, thanks

(sorry, the weekend happened, delayed response)

Luke

"This email is intended for the named recipient only. The information contained in this message may be confidential, or commercially sensitive. If you are not the intended recipient you must not reproduce or distribute any part of this email, disclose its contents to any other party, or take any action in reliance on it, or in reference to it. If you have received this email in error, would you please contact the sender immediately and delete/destroy all copies of this message, both electronic and otherwise. It is the recipient's duty to virus scan and otherwise test the enclosed information before using the information or loading attached files onto any computer system. Oasis Asset Management Ltd does not warrant that the information contained in this e-mail is free from viruses, defects, errors, interception or interference. Any views expressed in this message are those of the individual sender, except where that sender specifically states them to be the views of Oasis Asset Management Ltd."

______________________________________________________________________
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email 
______________________________________________________________________

------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=1065&dsMessageId=2415642

To unsubscribe from this discussion, e-mail: [users-unsubscribe@...].

RE: svn and wscript

by Luke Mason :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

-----Original Message-----
From: BRM [mailto:bm_witness@...]
Sent: Saturday, 7 November 2009 9:44 AM
To: users@...
Subject: Re: svn and wscript

----- Original Message ----
From: Ulrich Eckhardt <eckhardt@...>
To: users@...
Sent: Fri, November 6, 2009 6:43:07 AM
Subject: Re: svn and wscript
> >                 LogSectionOpen "runCmd"
> >                 do while not objExecObject.StdOut.AtEndOfStream
> >                         strText = objExecObject.StdOut.ReadLine()
> >                         Log strText, "", LOG_NORMAL
> >                 loop
> While waiting for the process to finish, you need to pump its output
to the
> log already.
> BTW, you are discarding any output to stderr, I think. Try using

I didn't catch this earlier - as I think there may be some other issues
- but the proper
thing to do is the following:

Set objExecObject = objShell.Exec(cmd)
strText = objExecObject.StdOut.ReadAll()



I use things in a javaScript with the CollabNet build of the svn
command-line client, and it works very well.
I don't have any issues with buffering at all, but I do have to read all
of it .

For some reason doing the loop just doesn't work - I think WSH doesn't
buffer right for that to function or something.

Ben

I'll try this too Ben, ty.

Luke

"This email is intended for the named recipient only. The information contained in this message may be confidential, or commercially sensitive. If you are not the intended recipient you must not reproduce or distribute any part of this email, disclose its contents to any other party, or take any action in reliance on it, or in reference to it. If you have received this email in error, would you please contact the sender immediately and delete/destroy all copies of this message, both electronic and otherwise. It is the recipient's duty to virus scan and otherwise test the enclosed information before using the information or loading attached files onto any computer system. Oasis Asset Management Ltd does not warrant that the information contained in this e-mail is free from viruses, defects, errors, interception or interference. Any views expressed in this message are those of the individual sender, except where that sender specifically states them to be the views of Oasis Asset Management Ltd."

______________________________________________________________________
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email 
______________________________________________________________________

------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=1065&dsMessageId=2415643

To unsubscribe from this discussion, e-mail: [users-unsubscribe@...].

RE: svn and wscript

by Luke Mason :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

-----Original Message-----
From: BRM [mailto:bm_witness@...]
Sent: Saturday, 7 November 2009 9:44 AM
To: users@...
Subject: Re: svn and wscript

----- Original Message ----
From: Ulrich Eckhardt <eckhardt@...>
To: users@...
Sent: Fri, November 6, 2009 6:43:07 AM
Subject: Re: svn and wscript
> >                 LogSectionOpen "runCmd"
> >                 do while not objExecObject.StdOut.AtEndOfStream
> >                         strText = objExecObject.StdOut.ReadLine()
> >                         Log strText, "", LOG_NORMAL
> >                 loop
> While waiting for the process to finish, you need to pump its output
to the
> log already.
> BTW, you are discarding any output to stderr, I think. Try using

I didn't catch this earlier - as I think there may be some other issues
- but the proper
thing to do is the following:

Set objExecObject = objShell.Exec(cmd)
strText = objExecObject.StdOut.ReadAll()



I use things in a javaScript with the CollabNet build of the svn
command-line client, and it works very well.
I don't have any issues with buffering at all, but I do have to read all
of it .

For some reason doing the loop just doesn't work - I think WSH doesn't
buffer right for that to function or something.

Ben

------------------------------------------------------
[snip]

Ok,

I've changed the script a bit, incorporated the changes suggested by Uli
& Ben:

Function runCmd(cmd, msg)
        debug("Function: runCmd: " & msg)
        Dim objShell
        Dim objExecObject

        Set objShell = WScript.CreateObject("WScript.Shell")
        Set objExecObject = objShell.Exec(cmd)

        ' wait for it to finish
        i = 0
        do while objExecObject.Status = 0
                WScript.Sleep 100
                i = i + 1
                debug("Loop " & i)
        loop

        LogSectionOpen "runCmd"
        Log "StdOut", objExecObject.StdOut.ReadAll, LOG_NORMAL
        Log "StdErr", objExecObject.StdErr.ReadAll, LOG_WARN
        LogSectionClose "runCmd"
       
        runCmd = objExecObject.ExitCode
        Set objExecObject = Nothing
        Set objShell = Nothing
End Function

The loop counter shows me that objExecObject.Status never changes from
zero.
While running, the folder structure is created, the .svn dir, subdirs
and files are created,
but the working copy files are not.  When the task is killed (ctrl-c)
the working copy files are created.

http://msdn.microsoft.com/en-us/library/443b45a5%28VS.85%29.aspx tells
me that
WshRunning ( = 0)The job is still running.
WshFinished ( = 1) The job has completed.

Is SVN not returning a correct status?  How can I tell?  This seems to
be distinct to the ExitCode, which is another
property altogether.  

Updated svn on my box for testing:
D:\>svn --version
svn, version 1.6.6 (r40053)
   compiled Oct 19 2009, 09:36:48

Copyright (C) 2000-2009 CollabNet.



"This email is intended for the named recipient only. The information contained in this message may be confidential, or commercially sensitive. If you are not the intended recipient you must not reproduce or distribute any part of this email, disclose its contents to any other party, or take any action in reliance on it, or in reference to it. If you have received this email in error, would you please contact the sender immediately and delete/destroy all copies of this message, both electronic and otherwise. It is the recipient's duty to virus scan and otherwise test the enclosed information before using the information or loading attached files onto any computer system. Oasis Asset Management Ltd does not warrant that the information contained in this e-mail is free from viruses, defects, errors, interception or interference. Any views expressed in this message are those of the individual sender, except where that sender specifically states them to be the views of Oasis Asset Management Ltd."

______________________________________________________________________
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email 
______________________________________________________________________

------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=1065&dsMessageId=2415660

To unsubscribe from this discussion, e-mail: [users-unsubscribe@...].

Re: svn and wscript

by Ulrich Eckhardt :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Monday 09 November 2009, Luke Mason wrote:

> I've changed the script a bit, incorporated the changes suggested by Uli
> & Ben:
>
> Function runCmd(cmd, msg)
> debug("Function: runCmd: " & msg)
> Dim objShell
> Dim objExecObject
>
> Set objShell = WScript.CreateObject("WScript.Shell")
> Set objExecObject = objShell.Exec(cmd)
>
> ' wait for it to finish
> i = 0
> do while objExecObject.Status = 0
> WScript.Sleep 100
> i = i + 1
> debug("Loop " & i)
> loop
>
> LogSectionOpen "runCmd"
> Log "StdOut", objExecObject.StdOut.ReadAll, LOG_NORMAL
> Log "StdErr", objExecObject.StdErr.ReadAll, LOG_WARN
> LogSectionClose "runCmd"
>
> runCmd = objExecObject.ExitCode
> Set objExecObject = Nothing
> Set objShell = Nothing
> End Function
>
> The loop counter shows me that objExecObject.Status never changes from
> zero.


You incorporated Ben's changes, but the problem still remains: svn.exe can't
write its output, so it sits there waiting for the other side to process its
buffers. Just drop the loop where you try to wait for it to finish. Instead,
rely on the ReadAll, which will only return when svn.exe has finished by
itself.

Note: I'm not sure if even that is reliable. The point is that if svn.exe
writes significant amounts of data to stderr, it will block, too. If you
redirect the stderr output, you should be fine though.

> Is SVN not returning a correct status?  How can I tell?  This seems to
> be distinct to the ExitCode, which is another
> property altogether.

No, this is a classical deadlock. SVN wants to give you some data before it
finishes. Your wscript is waiting for SVN to finish before taking any data
from it. It can not work this way.

Uli

--
ML: http://subversion.tigris.org/mailing-list-guidelines.html
FAQ: http://subversion.tigris.org/faq.html
Docs: http://svnbook.red-bean.com/

Sator Laser GmbH, Fangdieckstraße 75a, 22547 Hamburg, Deutschland
Geschäftsführer: Thorsten Föcking, Amtsgericht Hamburg HR B62 932

**************************************************************************************
Sator Laser GmbH, Fangdieckstraße 75a, 22547 Hamburg, Deutschland
Geschäftsführer: Thorsten Föcking, Amtsgericht Hamburg HR B62 932
**************************************************************************************
           Visit our website at <http://www.satorlaser.de/>
**************************************************************************************
Diese E-Mail einschließlich sämtlicher Anhänge ist nur für den Adressaten bestimmt und kann vertrauliche Informationen enthalten. Bitte benachrichtigen Sie den Absender umgehend, falls Sie nicht der beabsichtigte Empfänger sein sollten. Die E-Mail ist in diesem Fall zu löschen und darf weder gelesen, weitergeleitet, veröffentlicht oder anderweitig benutzt werden.
E-Mails können durch Dritte gelesen werden und Viren sowie nichtautorisierte Änderungen enthalten. Sator Laser GmbH ist für diese Folgen nicht verantwortlich.
**************************************************************************************

------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=1065&dsMessageId=2415707

To unsubscribe from this discussion, e-mail: [users-unsubscribe@...].

RE: svn and wscript

by Luke Mason :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

-----Original Message-----
From: Ulrich Eckhardt [mailto:eckhardt@...]
Sent: Monday, 9 November 2009 7:35 PM
To: users@...
Subject: Re: svn and wscript

On Monday 09 November 2009, Luke Mason wrote:
> I've changed the script a bit, incorporated the changes suggested by Uli
> & Ben:
>
[snip]


You incorporated Ben's changes, but the problem still remains: svn.exe can't
write its output, so it sits there waiting for the other side to process its
buffers. Just drop the loop where you try to wait for it to finish. Instead,
rely on the ReadAll, which will only return when svn.exe has finished by
itself.

Note: I'm not sure if even that is reliable. The point is that if svn.exe
writes significant amounts of data to stderr, it will block, too. If you
redirect the stderr output, you should be fine though.

> Is SVN not returning a correct status?  How can I tell?  This seems to
> be distinct to the ExitCode, which is another
> property altogether.

No, this is a classical deadlock. SVN wants to give you some data before it
finishes. Your wscript is waiting for SVN to finish before taking any data
from it. It can not work this way.

Uli

--
[snip]

I've removed the loop on status as suggested and things work!  I use .ReadAll as suggested,
But then split it on crlf and log each line individually.  It makes things prettier ^_^

Thankyou for the advice.

Function runCmd(cmd, msg)
        debug("Function: runCmd: " & msg)
        Dim objShell
        Dim objExecObject
        Dim strText

        Set objShell = WScript.CreateObject("WScript.Shell")
        Set objExecObject = objShell.Exec(cmd)

        LogSectionOpen "runCmd"
        strText = trim(objExecObject.StdOut.ReadAll)
        if len(strText) > 0 then
                LogSectionOpen "StdOut"
                LogSplitString strText, vbCrLf, LOG_NORMAL
                LogSectionClose "StdOut"
        end if
       
        strText = trim(objExecObject.StdErr.ReadAll)
        if len(strText) > 0 then
                LogSectionOpen "StdErr"
                LogSplitString strText, vbCrLf, LOG_WARN
                LogSectionClose "StdErr"
        end if
        LogSectionClose "RunCmd"
       
        runCmd = objExecObject.ExitCode
        Set objExecObject = Nothing
        Set objShell = Nothing
End Function



"This email is intended for the named recipient only. The information contained in this message may be confidential, or commercially sensitive. If you are not the intended recipient you must not reproduce or distribute any part of this email, disclose its contents to any other party, or take any action in reliance on it, or in reference to it. If you have received this email in error, would you please contact the sender immediately and delete/destroy all copies of this message, both electronic and otherwise. It is the recipient's duty to virus scan and otherwise test the enclosed information before using the information or loading attached files onto any computer system. Oasis Asset Management Ltd does not warrant that the information contained in this e-mail is free from viruses, defects, errors, interception or interference. Any views expressed in this message are those of the individual sender, except where that sender specifically states them to be the views of Oasis Asset Management Ltd."

______________________________________________________________________
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email 
______________________________________________________________________

------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=1065&dsMessageId=2416008

To unsubscribe from this discussion, e-mail: [users-unsubscribe@...].