aboutsummaryrefslogtreecommitdiff
path: root/tools/mhmake/src
diff options
context:
space:
mode:
Diffstat (limited to 'tools/mhmake/src')
-rw-r--r--tools/mhmake/src/build.cpp62
-rw-r--r--tools/mhmake/src/util.h2
2 files changed, 32 insertions, 32 deletions
diff --git a/tools/mhmake/src/build.cpp b/tools/mhmake/src/build.cpp
index 6d3c4afda..d1c4a32d1 100644
--- a/tools/mhmake/src/build.cpp
+++ b/tools/mhmake/src/build.cpp
@@ -711,7 +711,12 @@ static void CommandSep(const string &Command, int &EndPos, int &NextBegin)
{
EndPos=Command.find('&',NextBegin);
if (EndPos==string::npos || !EndPos)
+ {
+ // When there is only one command return that command, so we run %comspec% commands
+ // always via a temporary batch file. This is to avoid problems when quotes and pipe
+ // characters in parameters when using cmd /c
return;
+ }
EndPos--;
char C=Command[EndPos];
NextBegin=EndPos+2;
@@ -753,39 +758,34 @@ mh_pid_t mhmakefileparser::OsExeCommand(const string &Command, const string &Par
int NextBegin=0;
int EndPos=0;
CommandSep(ComspecCommandLine,EndPos,NextBegin);
- if (EndPos!=string::npos)
- {
- // We have multiple commands so create an temporary batch file
- FILE *pFile=(FILE*)1;
- char Filename[MAX_PATH];
- int Nr=1;
- while (1)
- {
- sprintf(Filename,"%s\\tmp%d.bat",m_MakeDir->GetFullFileName().c_str(),Nr);
- pFile=fopen(Filename,"r");
- if (!pFile)
- break;
- fclose(pFile);
- Nr++;
- }
- pFile=fopen(Filename,"w");
- fprintf(pFile,"@echo off\n");
- int PrevPos=0;
- while (EndPos!=string::npos)
- {
- string SubCommand=ComspecCommandLine.substr(PrevPos,EndPos-PrevPos+1);
- fprintf(pFile,"%s\n",SubCommand.c_str());
- PrevPos=NextBegin;
- CommandSep(ComspecCommandLine,EndPos,NextBegin);
- }
- string SubCommand=ComspecCommandLine.substr(PrevPos);
- fprintf(pFile,"%s\n",SubCommand.c_str());
+ // We have multiple commands so create an temporary batch file
+ FILE *pFile=(FILE*)1;
+ char Filename[MAX_PATH];
+ int Nr=1;
+ while (1)
+ {
+ sprintf(Filename,"%s\\tmp%d.bat",m_MakeDir->GetFullFileName().c_str(),Nr);
+ pFile=fopen(Filename,"r");
+ if (!pFile)
+ break;
fclose(pFile);
- FullCommandLine+=QuoteFileName(Filename);
- ((mhmakefileparser*)this)->m_FilesToRemoveAtEnd.push_back(string(Filename));
+ Nr++;
}
- else
- FullCommandLine+=ComspecCommandLine;
+ pFile=fopen(Filename,"w");
+ fprintf(pFile,"@echo off\n");
+ int PrevPos=0;
+ while (EndPos!=string::npos)
+ {
+ string SubCommand=ComspecCommandLine.substr(PrevPos,EndPos-PrevPos+1);
+ fprintf(pFile,"%s\n",SubCommand.c_str());
+ PrevPos=NextBegin;
+ CommandSep(ComspecCommandLine,EndPos,NextBegin);
+ }
+ string SubCommand=ComspecCommandLine.substr(PrevPos);
+ fprintf(pFile,"%s\n",SubCommand.c_str());
+ fclose(pFile);
+ FullCommandLine+=QuoteFileName(Filename);
+ ((mhmakefileparser*)this)->m_FilesToRemoveAtEnd.push_back(string(Filename));
}
else
{
diff --git a/tools/mhmake/src/util.h b/tools/mhmake/src/util.h
index 882ceb325..069effc07 100644
--- a/tools/mhmake/src/util.h
+++ b/tools/mhmake/src/util.h
@@ -50,7 +50,7 @@
#define PLATFORM "linux"
#endif
-#define MHMAKEVER "2.3.29"
+#define MHMAKEVER "2.3.30"
class makecommand
{