[wpkg-users] [Bug 123] New: Executed commands that lock installation process. - Tentative Solution(s) attached :-)

bugzilla-daemon at bugzilla.wpkg.org bugzilla-daemon at bugzilla.wpkg.org
Tue Jun 17 17:10:20 CEST 2008


http://bugzilla.wpkg.org/show_bug.cgi?id=123

           Summary: Executed commands that lock installation process. -
                    Tentative Solution(s) attached :-)
           Product: WPKG
           Version: 1.1.x-M
          Platform: PC
        OS/Version: Windows XP
            Status: NEW
          Severity: normal
          Priority: P2
         Component: wpkg.js
        AssignedTo: mangoo at wpkg.org
        ReportedBy: k.e.jones at brighton.ac.uk
         QAContact: wpkg-users at lists.wpkg.org


Hi,

 This should be an easy one fix :-)

Problem:

 Whilst processing *some* commands in a package definition, the exec'd process
locks and is terminated by being timed out rather than by normal means. This
can happen despite the command being perfectly legitimate and valid.

Scenario:

 I've tracked it down to a little known 'feature' of the wscript.exec method.
The command I was using generated a lot of output on StdOut. Unfortunately the
exec method only has 8K buffers (from what I've read). When they fill up it
halts the process until there's buffer space available. The end result is the
valid command 'appears' to hang. By inferance, it should also equally apply to
any command that generates a lot of output on StdErr.

 Workaround:

Ensure that any command you use redirects output to null(nul). Appending "1>nul
2>nul" to batch script lines works nicely!

 Potential Code Fix:

In function exec(cmd, timeout, workdir);

-- snip --
while (shellExec.status == 0) {
    WScript.sleep(1000);
    count++;

    // Read and discard the output buffers to prevent process blocking
    if (!shellExec.StdOut.AtEndOfStream) {shellExec.StdOut.ReadAll();}
    if (!shellExec.StdErr.AtEndOfStream) {shellExec.StdErr.ReadAll();}

    if (count >= timeout) {
        return -1;
    }
-- snip --

Hopefully this save a few moments of hair pulling :-)

Regards,

Keith

 PS - Perhaps it might be useful to adopt a couple of the spare logging flags
to allow people to log those text streams? They'd probably be useful for
isolating situations when people are not sure if it's a WPKG configuration
issue or a problem with the installer command.


-- 
Configure bugmail: http://bugzilla.wpkg.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.



More information about the wpkg-users mailing list