I'm wondering, how do I get the output of an execwait command in NSIS. For example, if I run tree, how would I get the output, which would be the actual tree?
You can't do that with ExecWait, you have to use one of the plugins: nsExec, ExecDos
or ExecCmd
Related
everyone, I am a fresh here as well as to linux
i want to use the intel pin tool to help me count the instructions executed in a quick sort program, just a homework, but when i did this as the readme document told me, like
cd source/tools/SimpleExamples
make obj-ia32/opcodemix.so
the system told me
make: * No rule to make target `obi-ia32/opcodemix.so'. Stop.
and i also tried obj-intel64,nothing changed.
can anybody tell me what is going on here, i am really confused with this pin stuff.
cd pintool/source/tools/ManualExamples
type command as
make inscount0.test
this commnad compile and show you the out put file then use following command on same directory
../../../pin -t obj-ia32/inscount0.so -- /bin/ls
this will make .so file after that see the ouput by using following command
cat inscount.out
I can't tell exactly what your question is. Format your commands with the code and separate them line by line, so I can know what you executed.
Anyway, if I'm right, you should just type:
make
(without targets) in under source/tools/ManualExamples, and it should build them all.
I ame using Linux Mint and I have to set some new environment variables.
I edited the file bash.bashrc in etc/ appending this line:
export NDK=/home/myname/Scrivania/android-ndk
but if i write on the shell the command $NDK i get this:
bash: home/myname/Scrivania/android-ndk: File o directory non esistente
why?
you get this error message exactly because you asked for it =)
sh#$NDK <enter>
keeping things simple such command tries to execute programs which stored inside NDK variable,
if it's what you tried to achieve then you should check that it's really exists.
if you want just to output value use:
sh#echo $NDK
$NDK is not a command. When you say $NDK at the shell prompt, then the OS tries to execute /home/myname/Scrivania/android-ndk which is probably not what you want.
Even if the directory /home/myname/Scrivania/android-ndk were to exist you would get the error you mentioned upon saying $NDK. You probably wanted to say cd $NDK or such.
type source .bashrc
in your terminal.
I am trying to suppress the output window which pops up after executing a psql command in NSIS
ExecWait 'psql -U postgres -f "Path\To\File.sql" postgres'
I tried '>nul' after looking at this link. But that doesn't work.
To avoid the black DOS box, you can use nsExec::Exec instead of Execwait.
Using vanilla NSIS, you can also use ExecShellWait with SW_HIDE like so:
ExecShellWait "" "$INSTDIR\myservice.exe" "install" SW_HIDE
...although nsExec is clearly the way to go if you want to capture output.
I'm creating my first NSI script and I'm just wondering if I can execute a command-line command from NSIS or should I just execute a batch file? I don't really know where to begin and other similar topics have gone a little over my head.
I would recommend taking a look at the nsExec plugin. I just recently had a situation where I needed to ping a server from inside an NSIS script, and the following code worked perfectly for me.
nsExec::Exec '"C:\Windows\System32\PING.EXE" $URL'
The benefit of using nsExec is that it executes the command without making a dos box pop up on your screen. The return value is pushed onto the stack, and there are a couple different ways that you can access the output of the program as well (if any exists).
There isn't a whole lot of information about the plugin on the NSIS website that I could find, but the following link should get you started in the right direction:
http://nsis.sourceforge.net/Docs/nsExec/nsExec.txt
Edit:
I noticed you asked specifically about a COPY command which is an internal DOS command, meaning that you won't be able to execute it like I did with ping. I may be mistaken but you shouldn't need to use any outside programs to carry out basic commands like this. You should be able to replicate most of the internal commands using NSIS commands.
For Example to copy a file (or multiple files) use the NSIS command: CopyFiles
The NSIS Scripting Reference is your friend :) (So is ctrl+f)
Try using exec command http://nsis.sourceforge.net/Docs/Chapter4.html:
4.9.1.2 Exec
command
Execute the specified program and continue immediately. Note that the file specified must exist on the target system, not the compiling system. $OUTDIR is used for the working directory. The error flag is set if the process could not be launched. Note, if the command could have spaces, you should put it in quotes to delimit it from parameters. e.g.: Exec '"$INSTDIR\command.exe" parameters'. If you don't put it in quotes it will not work on Windows 9x with or without parameters.
Exec '"$INSTDIR\someprogram.exe"'
Exec '"$INSTDIR\someprogram.exe" some parameters'
We can launch a command-line command from NSIS, get the returned value and further develop the installation logic based on that.
Example: Let's say we need to get the installed clang compiler version. To get the version we have to launch:
clang --version
In NSIS we do this using ExecToStack:
nsExec::ExecToStack 'cmd /c "clang --version"'
Pop $0
Pop $0
;now we have the version in $0
Warning: Only the second Pop $0 gets the response that we want, in this case the clang version. The first Pop $0 grabs the exit code.
I want to run a command in SCons which doesn't have any input/output files (actually the input and output are the same file). At the moment I am just manually running it with subprocess.Popen but is there a more SConsy way of doing it?
You can use the Command function to run whatever external command you run via Popen, and you can use the AlwaysBuild function to ensure your command is always run even if the target file exists. Scons doesn't like dependency cycles, so leave the source list empty.
myfile = env.Command('myfile.out', [], 'echo Hello world > $TARGETS')
env.AlwaysBuild(myfile)
The scons wiki also has a recipe for PhonyTargets which makes it easy to set up a lot of simple commands.