added !execute
git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@3594 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
parent
3181bf4b4d
commit
bb3f7be9ba
4 changed files with 27 additions and 0 deletions
|
@ -40,6 +40,14 @@ This command will echo a message to the user compiling the script.
|
|||
|
||||
This command will issue an error to the script compiler and will stop execution of the script. You can also add a message to this error.
|
||||
|
||||
\S1{execute} !execute
|
||||
|
||||
\c command
|
||||
|
||||
This command will execute 'command' using a call to CreateProcess(). Unlike \R{system}{!system}, it does not use the command line processor, so input/output redirection and commands like 'cd', 'dir' and 'type' can not be used. !execute also ignores the return value of the executed command. Currently, the only known advantage of !execute over \R{system}{!system} is that it does not give trouble when the current working directory is specified using UNC.
|
||||
|
||||
On POSIX platforms, !execute will use system() just like \R{system}{!system}.
|
||||
|
||||
\S1{packhdr} !packhdr
|
||||
|
||||
\c tempfile command
|
||||
|
|
|
@ -2603,6 +2603,23 @@ int CEXEBuild::doCommand(int which_token, LineParser &line)
|
|||
SCRIPT_MSG("!system: returned %d\n",ret);
|
||||
}
|
||||
return PS_OK;
|
||||
case TOK_P_EXECUTE:
|
||||
{
|
||||
char *exec=line.gettoken_str(1);
|
||||
#ifdef _WIN32
|
||||
PROCESS_INFORMATION pi;
|
||||
STARTUPINFO si={sizeof(STARTUPINFO),};
|
||||
if (CreateProcess(NULL,exec,NULL,NULL,FALSE,0,NULL,NULL,&si,&pi))
|
||||
{
|
||||
WaitForSingleObject(pi.hProcess,INFINITE);
|
||||
CloseHandle(pi.hThread);
|
||||
CloseHandle(pi.hProcess);
|
||||
}
|
||||
#else
|
||||
system(exec);
|
||||
#endif
|
||||
SCRIPT_MSG("!execute: \"%s\"\n",exec);
|
||||
}
|
||||
case TOK_P_ADDINCLUDEDIR:
|
||||
include_dirs.add(line.gettoken_str(1),0);
|
||||
return PS_OK;
|
||||
|
|
|
@ -216,6 +216,7 @@ static tokenType tokenlist[TOK__LAST] =
|
|||
{TOK_XPSTYLE, "XPStyle",1,0,"(on|off)",TP_GLOBAL},
|
||||
{TOK_P_PACKEXEHEADER,"!packhdr",2,0,"temp_file_name command_line_to_compress_that_temp_file",TP_ALL},
|
||||
{TOK_P_SYSTEMEXEC,"!system",1,2,"command [<|>|<>|=) retval]",TP_ALL},
|
||||
{TOK_P_EXECUTE,"!execute",1,0,"command",TP_ALL},
|
||||
{TOK_P_ADDINCLUDEDIR,"!AddIncludeDir",1,0,"dir",TP_ALL},
|
||||
{TOK_P_INCLUDE,"!include",1,0,"filename.nsi",TP_ALL},
|
||||
{TOK_P_CD,"!cd",1,0,"absolute_or_relative_new_directory",TP_ALL},
|
||||
|
|
|
@ -79,6 +79,7 @@ enum
|
|||
TOK_P_UNDEF,
|
||||
TOK_P_PACKEXEHEADER,
|
||||
TOK_P_SYSTEMEXEC,
|
||||
TOK_P_EXECUTE,
|
||||
TOK_P_ADDINCLUDEDIR,
|
||||
TOK_P_INCLUDE,
|
||||
TOK_P_CD,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue