瀏覽代碼

Print out command line before running it with -vx option

git-svn-id: trunk@26443 -
pierre 11 年之前
父節點
當前提交
e87e2f9c30
共有 1 個文件被更改,包括 25 次插入0 次删除
  1. 25 0
      compiler/cfileutl.pas

+ 25 - 0
compiler/cfileutl.pas

@@ -1523,6 +1523,10 @@ end;
       var
       var
         quote_script: tscripttype;
         quote_script: tscripttype;
       begin
       begin
+
+        if do_checkverbosity(V_Executable) then
+          do_comment(V_Executable,'Executing "'+Path+'" with command line "'+
+            ComLine+'"');
         if (cs_link_on_target in current_settings.globalswitches) then
         if (cs_link_on_target in current_settings.globalswitches) then
           quote_script:=target_info.script
           quote_script:=target_info.script
         else
         else
@@ -1535,7 +1539,21 @@ end;
 
 
 
 
     function RequotedExecuteProcess(const Path: AnsiString; const ComLine: array of AnsiString; Flags: TExecuteFlags): Longint;
     function RequotedExecuteProcess(const Path: AnsiString; const ComLine: array of AnsiString; Flags: TExecuteFlags): Longint;
+      var
+        i : longint;
+        st : string;
       begin
       begin
+        if do_checkverbosity(V_Executable) then
+          begin
+            if high(ComLine)=0 then
+              st:=''
+            else
+              st:=ComLine[1];
+            for i:=2 to high(ComLine) do
+              st:=st+' '+ComLine[i];
+            do_comment(V_Executable,'Executing "'+Path+'" with command line "'+
+              st+'"');
+          end;
         result:=sysutils.ExecuteProcess(Path,ComLine,Flags);
         result:=sysutils.ExecuteProcess(Path,ComLine,Flags);
       end;
       end;
 
 
@@ -1545,11 +1563,15 @@ end;
         expansion under linux }
         expansion under linux }
 {$ifdef hasunix}
 {$ifdef hasunix}
       begin
       begin
+        if do_checkverbosity(V_Used) then
+          do_comment(V_Executable,'Executing "'+Command+'" with fpSystem call');
         result := Unix.fpsystem(command);
         result := Unix.fpsystem(command);
       end;
       end;
 {$else hasunix}
 {$else hasunix}
   {$ifdef hasamiga}
   {$ifdef hasamiga}
       begin
       begin
+        if do_checkverbosity(V_Used) then
+          do_comment(V_Executable,'Executing "'+Command+'" using RequotedExecuteProcess');
         result := RequotedExecuteProcess('',command);
         result := RequotedExecuteProcess('',command);
       end;
       end;
   {$else hasamiga}
   {$else hasamiga}
@@ -1557,6 +1579,9 @@ end;
         comspec : string;
         comspec : string;
       begin
       begin
         comspec:=GetEnvironmentVariable('COMSPEC');
         comspec:=GetEnvironmentVariable('COMSPEC');
+        if do_checkverbosity(V_Used) then
+          do_comment(V_Executable,'Executing "'+Command+'" using comspec "'
+            +ComSpec+'"');
         result := RequotedExecuteProcess(comspec,' /C '+command);
         result := RequotedExecuteProcess(comspec,' /C '+command);
       end;
       end;
    {$endif hasamiga}
    {$endif hasamiga}