I have a function as below :
function LONG ImportSSL(hMSI)
STRING exeDir;
STRING sslDir;
NUMBER nvSize;
LONG ret;
begin
nvSize = 256;
MsiGetProperty (hMSI, "SETUPEXEDIR", exeDir, nvSize);
sslDir = exeDir ^ "ssl\\myCertificate.pfx";
ret = LaunchAppAndWait(WINDIR, "certutil -f -p \"\" -importpfx \"" + sslDir + "\"", WAIT);
if (ret != 0) then return ret; endif;
return 0;
end;
by running Setup.exe as below:
MySetup.exe /v"/l*v c:\SetupLog.log"
I see the below error in log file :
CustomAction ImportSSL returned actual error code 1603 (note this may not be 100% accurate if translation happened inside sandbox)
Action ended 16:25:25: ImportSSL. Return value 3.
but when I execute certutil -f -p "" -importpfx "C:\myCertificate.pfx" by command prompt there is no any error , and that certeficate imported into IIS.
How can I know the details of error?
Any help will be truly appreciated.
The problem solution will depend on the following: 1)Is certificate file being delivered by the installer, or is it supposed to be present on the target machine? Check that the installer delivers it as a permanent file, or support file (in [SUPPORTDIR]), or if the file really exists; 2) where this custom action is located? Normally actions like that should be placed after InstallFinalize.
Related
mpdf.create_pvf(card, mpImgBytes, mlen, L"");
int inDoc = mpdf.open_pdi_document(card, L"");
I am using pdflib version 9.3.
open_pdi_document returns -1
create_pvf creates an empty file of size 0.
Any idea on what could be wrong?
I am running pdflib on Windows 10, using C++.
I would recommend that you also retrieve the error reason in case of an error (open_pdi_document() returns -1) or work with the PDFlib errorpolicy "exception". Then you will get a first impression what the problem might be, then your code could looks like
/* Open the input PDF */
indoc = mpdf.open_pdi_document(card, L"");
if (indoc == -1) {
wcerr << L"Error: " << mpdf.get_errmsg() << endl;
return 2;
}
create_pvf creates an empty file of size 0.
how did you identify that?
Not sure how relevant my answer is, but this could help someone.
Installing ghostscript on my machine, resolved the error.
I would like to run an external .bat file using groovy script in soapUI. also would like to use the output generated from the external file as the value for the header
here is the script that I am using to run the bat file
String line
def p = "cmd /c C:\\Script\\S1.bat".execute()
def bri = new BufferedReader (new InputStreamReader(p.getInputStream()))
while ((line = bri.readLine()) != null) {log.info line}
here is the content of the bat file
java -jar SignatureGen.jar -pRESOURCE -nRandomString -mGET -d/api/discussion-streams/metadata -teyJ0eXAiOiJKV1QiLCJhbGciOiJIUzUxMiJ9.eyJjbGllbnQiOiIxIiwicm9sZSI6IllGQURNSU4iLCJleHAiOjI3NTgzMjU2MDIsInRpIjo3MjAwNiwiaWF0IjoxNTU4MzI1NjAyLCJwZXJzb24iOiI1In0.bbci7ZBWmPsANN34Ris9H0-mosKF2JLTZ-530Rex2ut1kjCwprZr_196N-K1alFBH_A9pbG0MPspaDOnvOKOjA
The following code:
def p = "ls -la".execute()
def err = new StringBuffer()
def out = new StringBuffer()
p.waitForProcessOutput(out, err)
p.waitForOrKill(5000)
int ret = p.exitValue()
// optionally check the exit value and err for errors
println "ERR: $err"
println "OUT: $out"
// if you want to do something line based with the output
out.readLines().each { line ->
println "LINE: $line"
}
is based on linux, but translates to windows by just replacing the ls -la with your bat file invocation cmd /c C:\\Script\\S1.bat.
This executes the process, calls waitForProcessOutput to make sure the process doesn't block and that we are saving away the stdout and stderr streams of the process, and then waits for the process to finish using waitForOrKill.
After the waitForOrKill the process has either been terminated because it took too long, or it has completed normally. Whatever the case, the out variable will contain the output of the command. To figure out whether or not there was an error during bat file execution, you can inspect the ret and err variables.
I chose the waitForOrKill timeout at random, adjust to fit your needs. You can also use waitFor without a timeout which will wait until the process completes, but it is generally better to set some timeout to make sure your command doesn't execute indefinitely.
I am trying to run the following code, but the got #error 1 at startview command, and #error 2 in desc command.
use Win32::OLE;
$ct = Win32::OLE->new('ClearCase.ClearTool') or die "Could not create ClearTool object\n";
$view = "ccadm01_UARK_DEV";
$output = $ct->CmdExec("pwv") or die("Cleartool returned error: ", Win32::OLE->LastError(), "\n");
print ("pwv \$output = $output\n");
# error 1 : cleartool return error 0
$output = $ct->CmdExec("startview ccadm01_UARK_DEV") or die("Cleartool returned error: ", Win32::OLE->LastError(), "\n");
$CWD = $view_dir;
print( "Current directory: $CWD\n");
# error 2: No view context available
$output = $ct->CmdExec("describe -fmt \"%[versions]Cp\" activity:USR0200004985\#\\Unix_PVOB") or die("Cleartool returned error: ", Win32::OLE->LastError(), "\n");
print ("desc \$output = $output\n");
For #error 1, I tried the same command from DOS, it works.
You need to make sure your $view is a valid dynamic view tag for cleartool startview to work.
(make sure to not use cleartool setview, as it spawns a subshell)
Also if it returns error 0, you can assume it has worked: CAL might return an "error", but status 0 should mean the command has been executed.
An error different from 0, though, means something went wrong.
And you need to cd into that view (/view/<viewTag> or m:\<viewTag>) for a cleartool descr to work.
That one, executed in the wrong folder, is supposed to fail, hence "error 2".
The OP Jirong Hu points in the comments to Using Perl with Rational ClearCase Automation Library (CAL) and this script as an example.
So running into an issue with my code here not sure what exactly i'm doing wrong i pass it the two arguments it searches for the file but its always going to does not exist.
i pass this to the file
perl restore.cgi users_old_52715.tar.gz Ace_Walker
its not finding the file it exist i assure you.
#!/usr/bin/perl
use Archive::Tar;
my $tarPath = $ARGV[0];
my $playerfile = $ARGV[1].".ini";
my $tar = Archive::Tar->new($tarPath);
if ($tar->contains_file($playerfile)) {
$tar->read($tarPath);
$tar->extract_file($playerfile, './' );
print "Successfully restored $playerfile to production enviroment\n";
exit 0;
}else{
print $playefile." does not exist in this archive!\n";
exit 0;
}
Just writing Scott Hunter's comment as an answer:
Try using an absolute path instead of a relative one.
if( $tar->extract_file($playerfile, './'.$playerfile )){
print "Successfully restored $playerfile to production enviroment\n";
}
exit 0;
man Archive::Tar :
$tar->extract_file( $file, [$extract_path] )
Write an entry, whose name is equivalent to the file name provided to disk. Optionally takes a second parameter, which is the full native path (including filename) the entry will be written to.
I have console application ThirdPartyApplications.exe, that I have to run from windows service.
Console application give me reposes: OK, NOT OK and ERROR.
I need to capture these responses in my windows service.
I created function
using (var p = new System.Diagnostics.Process())
{
p.StartInfo.UseShellExecute = false;
p.StartInfo.RedirectStandardOutput = true;
p.StartInfo.FileName = #"C:\ThirdPartyApplications.exe";
p.StartInfo.Arguments = "3";
p.Start();
string o = p.StandardOutput.ReadToEnd();
p.WaitForExit();
}
How can I capture this output?
EDIT
using (var p = new System.Diagnostics.Process())
{
p.StartInfo.UseShellExecute = false;
p.StartInfo.RedirectStandardOutput = true;
p.StartInfo.FileName = #"C:\ThirdPartyBatch.bat";
p.StartInfo.Arguments = "file.zip -user.properties";
p.Start();
string o = p.StandardOutput.ReadToEnd();
p.WaitForExit();
}
Batch file is
#echo off
call run.bat %* 1>log\out.txt 2>log\err.txt
#echo code %ERRORLEVEL%
exit /B %ERRORLEVEL%
here, in my variable o, I do not get message "code 10"
if I have
#ECHO off
ECHO Hello
PAUSE
Here, I get message "Hello", but if I change batch file
#ECHO off
call run.bat %* 1>log\out.txt 2>log\err.txt
ECHO Hello
PAUSE
I do not get message "Hello"
Any help?
How can I capture this output?
Only when not running as a service.
An executable on Windows has to call specific APIs (directly as a Win32 application or indirectly under a framework like .NET), if it doesn't call these (eg. logic based on a command line switch1) then it is a normal executable.
When run as a service the executable is started by the Service Control Manager (SCM), and there is no access to standard output, error or input.
1 This can be useful when developing and debugging services: an "interactive" mode allowing easy running from the command line or within a debugger.