[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

RE: svn and wscript

From: Luke Mason <lmason_at_oasisasset.com.au>
Date: Mon, 9 Nov 2009 14:24:05 +1100

-----Original Message-----
From: BRM [mailto:bm_witness_at_yahoo.com]
Sent: Saturday, 7 November 2009 9:44 AM
To: users_at_subversion.tigris.org
Subject: Re: svn and wscript

----- Original Message ----
From: Ulrich Eckhardt <eckhardt_at_satorlaser.com>
To: users_at_subversion.tigris.org
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_at_subversion.tigris.org].
Received on 2009-11-09 04:25:21 CET

This is an archived mail posted to the Subversion Users mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.