Following line in my nsis script is returning 7 :
ExecWait '"$mysqlfolder\bin\mysqldump" --user=$MySQLUser --password=$MysqlPassword --execute="tcm > D:\db_test.sql"' $2
I would like to know whats wrong with it.
Are you sure the exit code is not from mysqldump? You could verify this by running Process Monitor.
In this case the problem could be the stdout redirection (>), this type of redirection is implemented in cmd.exe so unless --execute calls cmd.exe it is not going to work.
If you want to capture the output (of the "root" child process) you have two options:
Prefix your command line with cmd.exe /C (Use ReadEnvStr "COMSPEC" if you need to support Win9x)
Use one of the exec plugins that will capture the output.
Related
I am using this command to source get.tcl file and giving options 'verbose' and 'instant':
source -verbose -instant get.tcl
the above command worked for me in tcl 8.4 but showing this error in tcl 8.5
source (script wrong # args: should be "source_orig ?-encoding name?
fileName"
if I write only
source get.tcl
It get passed in tcl 8.5
Is there any change related to this in tcl 8.5?
The source command only accepts one option (since 8.5), -encoding, which is used to specify what encoding the file being read is in (instead of the default guess of encoding as returned by encoding system). All it does is read the file into memory and (internally-equivalent-to-) eval the contents.
You can write to any variable you want prior to doing the source, including global variables like argv. With that (plus appropriate use of uplevel and catch, as required, and maybe also interp create) you can simulate running the script as a subprocess. But it's probably easier to not have the file expect to be handling arguments like that, and instead for it to define a command that you call immediately after the sourcing.
You can pass arguments to your sourced file by doing the following:
set ::argv [list -verbose -instant]
source get.tcl
I recommend using:
set ::argv [list -- -verbose -instant]
The -- will stop tclsh from processing any arguments after the --.
Sometimes tclsh will recognize an argument that is meant for your
program and process it. Your programs will need to know about
the -- and handle it appropriately.
I want to know what is the output of below line. Please explain me each symbol. Line is extracted from batch file.
'java -version 2^>^&1 ^| findstr /i "version"'
First take a look on Microsoft article about Using command redirection operators.
2>&1 redirects error messages written to error output stream STDERR to the standard output stream STDOUT. This results in getting standard messages as well as error messages written to same data stream.
The standard and error messages written to STDOUT of java.exe on printing version are used as input for command findstr by using | to get output just the line containing the version information and ignoring all other lines output by java.exe.
This command is obviously embedded in a FOR loop. Therefore it is necessary to escape > and & and | with ^ to get all those redirection operators applied to execution of java.exe instead of command FOR itself which would result in a syntax error.
Open a command prompt window and run there just java -version to see the version information output by Java if command processor could find a file java.* with a file extension listed in environment variable PATHEXT in current directory or a directory listed in environment variable PATH at all.
Next run in command prompt window java -version | findstr /i "version" to see what command findstr outputs on searching case-insensitive for a line containing the string version.
2>&1 respectively 2^>^&1 is unnecessary in my point of view.
I've set up slimv with the following command in vim:
let g:slimv_swank_cmd = '!gnome-terminal -e "sbcl --load ~/.vim/bundle/slimv/slime/start-swank.lisp &"'
When opening .lisp files and starting slimv, I recieve the following error message in the newly opened terminal window:
debugger invoked on a SB-INT:SIMPLE-FILE-ERROR in thread
#<THREAD "main thread" RUNNING {1002A8B203}>:
Couldn't load #P"~/.vim/bundle/slimv/slime/start-swank.lisp": file does not exist.
Type HELP for debugger help, or (SB-EXT:EXIT) to exit from SBCL.
restarts (invokable by number or by possibly-abbreviated name):
0: [CONTINUE] Ignore runtime option --load "~/.vim/bundle/slimv/slime/start-swank.lisp".
1: [ABORT ] Skip rest of --eval and --load options.
2: Skip to toplevel READ/EVAL/PRINT loop.
3: [EXIT ] Exit SBCL (calling #'EXIT, killing the process).
(LOAD #P"~/.vim/bundle/slimv/slime/start-swank.lisp" :VERBOSE NIL :PRINT NIL :IF-DOES-NOT-EXIST T :EXTERNAL-FORMAT :DEFAULT)
However, running the sbcl command from the terminal works properly because the file does exist on the path specified. How can I fix this issue?
You need to make sure that the tilde gets expanded. Expansion is provided by the shell.
You can also compute the pathname in Common Lisp using:
(merge-pathnames ".vim/bundle/slimv/slime/start-swank.lisp"
(user-homedir-pathname))
-> #P"/home/foobar/.vim/bundle/slimv/slime/start-swank.lisp"
Merging a relative pathname with an absolute pathname, adds the directory like above.
Both functions (merge-pathnames and user-homedir-pathname) are in the ANSI CL standard.
Hi how can I redirect result from ExecWait command
I was trying
ExecWait '"$INSTDIR\MyApp\isql.exe localhost:$INSTDIR\MyApp\tts.fdb -U SYSDBA -p password -i $INSTDIR\MyApp\src\dbfile.sql >>$INSTDIR\logfile.txt"'
But no luck, it did not create any log file. Any ideas?
I do not want to use any additional libraries.
Thanks
ExecWait is just a thin wrapper around the CreateProcess API and it does not support redirection.
The easy way to get redirection is to use cmd.exe/%comspec% with the /c switch and one of the exec plugins, nsExec, ExecDos or ExecCmd: "$sysdir\cmd.exe" /c "c:\your\app.exe" /param1 /param2 > "c:\file.txt"
If you search for "comspec" on the NSIS forum you will find many threads about this...
I think in nmake if I do this:
example :
set value=77
echo %%value%%
The result will display 77 on the console.
Is there a way for me to invoke a .cmd or .bat file that will affect the environment of the nmake.exe process? Suppose I put the statement set value=77 in a file called "setvalue.cmd". Then change the makefile to this:
example :
setvalue
echo %%value%%
I get:
%value%
Alternatively, if there's a way to set a macro within a command block, that would also work. Or, a way to set the value of a macro from a batch file, even outside a command block.
You can create an nmake snippet during makefile pre-processing, and read that in. Assuming batch.cmd outputs valid nmake syntax, then
!if [batch.cmd >makefile.auto]
!error *** Could not create makefile.auto
!endif
!include makefile.auto
You should ensure batch.cmd sets %errorlevel% appropriately (e.g., exit /b 22).
makefile.auto can contain anything, but you would probably want stuff like value=77. A couple of points:
Dereference value using nmake syntax ($(value))
You can pass parameters to batch.cmd if necessary ([batch.cmd $(OBJECTS) >makefile.auto])
No, I don't think so.