BuildForge - Passing variables as parameters that are declared as Assing Hidden - build

I have a build forge job that executes a bat file and intake password as a paramter. If i declare this paramter variable as normal text it works fine. But when I declare password as "Assing Hidden" it doesnt work and throws out error as meniotned below.
Any help is appreciated.
Command I am executing
call MpToSbx.bat SF %account% %password% %REL_NUM% %Track%
Condition
1. Works fine if password is delcared as regular text.
2. When password assigned as hidden it throws out error as below.I feels the command is not iterated correctly some how.
Error Message:
The system cannot find the path specified.
EXEC 'MpToSbx.bat' is not recognized as an internal or external command,
EXEC operable program or batch file.

The most probable cause of this error is that %password% is taken as a single word inside MpToSbx.bat file. To solve this error, first edit that file and change %2 by %~2 (to eliminate quotes in the parameter) and then enclose the password between quotes in the call; for example:
call MpToSbx.bat SF %account% "%password%" %REL_NUM% %Track%

Related

how to Give inputs to Lauterbach script?

I have practice script that take password from dialog box and set it to var. I want to modify it instead of taking password from dialog box it take it from command line like entering parameters to script.
I have read the ref but i can't find it out.
You can call a script with parameters by providing the parameters after the file name. Each parameter should be quoted:
DO my_script.cmm "<my_parameter1>" "<my_parameter2>"
The script can retrieve the parameter like below. In this example the script would fall-back to dialog or error handling if there is no password provided by command line.
PRIVATE &password
PARAMETERS &password
IF "&password"==""
(
;if no password provided from command line,
;then fall back to dialog or error handling.
)
PRINT "Password: &password"
ENDDO

Immuconf with Clojure not handling tree config files

Whenever I add a third config file to my .immuconf.edn I get:
No configuration files were specified, and neither an .immuconf.edn file nor
an IMMUCONF_CFG environment variable was found
This is driving me crazy since I cant really find anything wrong.
Using this loads thing OK:
["configs/betfair.edn" "configs/web-server.edn"]
however this generated an error:
["configs/betfair.edn" "configs/web-server.edn" "~/betfair.edn"]
This is the content of betfair.edn
{:betfair {:usr "..."
:pwd "..."
:app-key "..." ;; key used
:app-key-live "..."
:app-key-test "..."}}
(where ... is replaced with actual strings)
Why am I getting this error when adding the third file and how can I fix this?
Make sure that the last file specified in your <project dir>/.immuconf.edn (~/betfair.edn) exists in your home directory.
Immuconf does some magic to replace ~ in filenames specified in .immuconf.edn with a value of (System/getProperty "user.home") so you might check if that system property points to the same directory where your ~/betfair.edn file is located.
I have recreated your setup and it works on my machine so it is probably a problem with locations or access rights to your files. Unfortunately, error handling for the no arg invocation of (immuconf.config/load) doesn't help in troubleshooting as it swallows any exceptions and returns nil. That exception would probably tell you what kind of error occured (some file not found or some IO error happened). You might want to file a pull request with a patch to log such errors as warnings instead of ignoring them.

C++ execute temp file as bash script

I have a program that needs to run a program we'll call externalProg in parallel on our linux (CentOS) cluster - or rather, it needs to run many instances of externalProg, each on different cores. Each "thread" creates 3 files based on a few parameters - the inputs to externalProg, a command file to tell externalProg how to execute my file, and a bash script to set up the environment (calls a setup script provided by the manufacturer) and actually call externalProg with my inputs.
Since this needs to be parallel with an unknown number of concurrent threads and I don't want to risk overwriting another thread's files, I am creating temp files using
mkstemp("PREFIX_XXXXXX")
for these input files. After the external program runs, I extract the relevant data and store it, and close the temp files (therefore deleting them).
We'll call the files created (Which actually have a name based on the template above)
tmpInputs - Inputs to externalProg
tmpCommand - Input that tells externalProg how to execute tmpInputs
tmpBash - bash script to set up and call externalProg with my inputs
The file tmpBash looks something like
source /path/to/setup/script # Sets up environment variables
externalProg < /path/to/tmpCommand
where tmpCommand is just a simple text file.
The problem I'm having is actually executing the bash script. Within my program, I call
ostringstream launchcmd;
launchcmd << "bash " << path_to_tmpBash
system(launchcmd.str().c_str());
But nothing happens. No error, no warning, no 'file not found' or permission denied or anything. I have verified that the files are being created and have the correct content. The rest of the code after system() is executed successfully (Though it fails since externalProg wasn't run).
Strangely, if I go back to the terminal and type
bash /path/to/tmpBash
then externalProg is executed successfully. I have also cout'd the launchcmd string, copy and pasted that in to the terminal, which also works successfully. For some reason, this only fails when called within my program.
After a bit of experimentation, I've determined that system() calls /bin/sh on our cluster. If I change launchcmd to look like
/path/to/tmpBash
(So that the full command should look like /bin/sh /path/to/tmpBash), I get a permission denied error, which is no surprise. The problem is that I can't chmod +x the tmpBash file while it's still open, and if I close the file, it gets deleted - so I'm not sure how to address that.
Is there something obviously wrong I'm doing, or does system() have some nuance that I'm missing?
edit: I wanted to add that I can successfully call things like
system("echo $PATH")
and get the expected results (in this case, my default $PATH).
Two separate ideas:
Change your SHELL environment variable to be /bin/bash, then call system(),
or:
Use execve directly `execve('/bin/bash', ['/path/to/tmpBash'], environ)

popen and system behaves unexpectedly with multiple quoted file paths

I am trying to execute a dos command from within my C++ program, however soon as I add quotes to the output filepath (of a redirection) the command no longer gets executed and returns instantly. I've shown an example below of a path without spaces, but since paths may have spaces and thus be quoted for the shell to understand it properly I need to solve this dilemma - and I'm trying to get the simplest case working first.
i.e.
The following WORKS:
sprintf(exec_cmd,"\"C:/MySQL Server 5.5/bin/mysqldump.exe\" -u%s -p%s %s > C:/backup.bak",user,password,db_name);
system(exec_cmd);
The following does NOT work (notice the quotes around the output):
sprintf(exec_cmd,"\"C:/MySQL Server 5.5/bin/mysqldump.exe\" -u%s -p%s %s > \"C:/backup.bak\"",user,password,db_name);
system(exec_cmd);
I'm guessing it is choking somewhere. I've tried the same "exec_cmd" in popen to no avail.
Any help/advice is greatly appreciated.
I don't think your shell (cmd.exe) allows redirection to a file name with spaces. I couldn't make my command.com from DOS 6.22 accept it (I don't have a cmd.exe nearby to test).
Anyway, you can use the --result-file option to pass the redirection to the command itself.
mysqldump ... --result-file="file name" ...

System function seems to ignore quote marks

I'm running the following code (on Windows 7, if it makes a difference):
char temp[20000];
sprintf_s(temp, 20000, "\"C:\\Program Files\\Mozilla Firefox\\firefox.exe\" \"http://www.tvtak.com/servlet/Gateway/?C=addShows&channel=%s&show=%s\"", _channels[chId], name);
system(temp);
On running, the console displays:
'C:\Program' is not recognized as an
internal or external command, operable
program or batch file.
'channel' is not recognized as an internal or
external command, operable program or
batch file.
'show' is not recognized
as an internal or external command,
operable program or batch file.
But when I get the value of 'temp' via QuickWatch and paste it to CMD, it works fine. What's going on here?
I should mention that the parameters I'm appending to the string contain non-latin characters. Could this have something to do with it?
You are better off with CreateProcess() to avoid cmd.exe's quoting hell. But if you must use system() you can simply append if 1==1 to the beginning of your command so it doesn't remove the quotes for you.
system("if 1==1 \"C:\Program...");
For more information about this issue, run cmd.exe /? and look for /S.
You need to put entire string into yet another pair of quotation marks. And try to avoid C-style strings in C++ code.