[wpkg-users] [WPKGWrapper...]

Marco Gaiarin gaio at sv.lnf.it
Tue Mar 27 16:54:54 CEST 2007


Mandi! Tomasz Chmielewski
  In chel di` si favelave...

> Do you mean:

Ahem, broke, i meant broke...


> If 2, rather not, but it really depends on what you write there :)

Oh, i've only found a way not to loop on stdout to catch all the data,
but do that with only one row of code.

This is my wpkg wrapper. But seems that your new proposal to check exit
status on wpkg-after/wpkg-before made my work obsolete before it get
done... ;)))

-- 
dott. Marco Gaiarin				    GNUPG Key ID: 240A3D66
  Associazione ``La Nostra Famiglia''                http://www.sv.lnf.it/
  Polo FVG  -  Via della Bontà, 7 - 33078  -  San Vito al Tagliamento (PN)
  marco.gaiarin(at)sv.lnf.it	  tel +39-0434-842711  fax +39-0434-842797
-------------- next part --------------
/*******************************************************************************

 *

 * WPKGWrapper 0.1 - Windows Packager Wrapper

 * Copyright 2007 Marco Gaiarin <gaio (at) sv . lnf . it>

 *

 *   This program is free software; you can redistribute it and/or modify

 *   it under the terms of the GNU General Public License as published by

 *   the Free Software Foundation; either version 2 of the License, or

 *   (at your option) any later version.

 *

 *   This program is distributed in the hope that it will be useful,

 *   but WITHOUT ANY WARRANTY; without even the implied warranty of

 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the

 *   GNU General Public License for more details.

 *

 *   You should have received a copy of the GNU General Public License

 *   along with this program; if not, write to the Free Software

 *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA

 *

 *******************************************************************************/



// Configure here the Wrapper...

//

var env_var_name="LOCALNET";				// Environment variable name

var env_var_value="sv";					// Environment variable value ('server value')

var wpkg_js="cscript \\\\FILE\\wpkg\\wpkg.js";		// Remember to double the \ !!!









// Get environment var value...

//

var shell = new ActiveXObject("WScript.Shell");

var env_vars = shell.Environment("PROCESS");

var env_var_value_client = env_vars(env_var_name);



// Check against "server" one...

//

if (env_var_value_client != env_var_value) {

	WScript.Echo("This client does not belong to this WPKG server, skipping all the stuff...");

	WScript.Quit(0);

}



// Reapup commandline...

//

var cmdl = "";

var p = WScript.Arguments;

for (i=0; i < p.length; i++) {

	cmdl = (cmdl + p(i) + " " );

}



// right, executing command...

//

var cmd = wpkg_js + " " + cmdl;

var shellex = shell.Exec(cmd);



// Reapup stdout/stderr...

//

if (!shellex.StdErr.AtEndOfStream) {

	WScript.StdErr.Write(shellex.StdErr.ReadAll());

}

if (!shellex.StdOut.AtEndOfStream) {

	WScript.StdOut.Write(shellex.StdOut.ReadAll());

}



// exit...

//

WScript.Quit(shellex.status);

-------------- next part --------------




-------------- next part --------------
_______________________________________________
wpkg-users mailing list
wpkg-users at lists.wpkg.org
http://lists.wpkg.org/mailman/listinfo/wpkg-users


More information about the wpkg-users mailing list