x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

[Closed] Have Cook Commandlet output go to stdout?

We are currently experimenting with using the cook commandlet to cook assets on our build system.

The commandlet is run from a CMD shell on Windows but right after starting it does open its own console window where it displays its output. Since we are running it from a command line environment such as a build server we want it to output directly to the initial stdout channel instead of this additional console window.

Looking at the FEngineLoop::PreInit method, it looked like adding -stdout as a command line switch on the commandlet would cause it to really use the initial stdout channel but this does not change a thing and looking at the code further seems to indicate that the whole commandlet actually redirects all "stdout" output to its own custom output window.

Is there a way to disable this highly undesirable behaviour? There is no need to open an additional console window when already launched from a command line shell. Also, many build environments do actually not allow windows to be opened (when run as services for instance on Windows) so I suspect that this might cause issues in these cases.

Product Version: UE 4.8
Tags:
more ▼

asked Oct 02 '15 at 08:35 PM in Packaging & Deployment

avatar image

laurent.giroud.bhvr
36 1 4 5

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

The question has been closed Jul 13 '16 at 07:59 PM by Samantha Sutton for the following reason:

The question is answered, right answer was accepted


1 answer: sort voted first

This works in C#, you could write your own wrapper that handles output as you want (in this case it directs it to Log, after the invoke which would probably be needless in a simple console app.

 void StartProcess(string toolExeOrBatch, string cmdline)
 {
             System.Diagnostics.ProcessStartInfo oStartInfo = new System.Diagnostics.ProcessStartInfo();
             oStartInfo.FileName = toolExeOrBatch;
             oStartInfo.Arguments = cmdline;
             oStartInfo.ErrorDialog = true;
             oStartInfo.RedirectStandardOutput = true;
             oStartInfo.UseShellExecute = false;
             oStartInfo.CreateNoWindow = true;
             System.Diagnostics.Process process = System.Diagnostics.Process.Start(oStartInfo);
             process.OutputDataReceived += ToolOutputHandler;
             process.BeginOutputReadLine();
 
             while (!process.HasExited)
             {
                 Application.DoEvents(); // This keeps your form responsive by processing events
             }
 
             bool bSuccess = process.ExitCode != 0;
             if(bSuccess)
             {
                 Log("Calling External Process-  Completed!");
             }
             else
             {
                 Log("Calling External Process-  FAILED! Return code: " + process.ExitCode.ToString());
             }
             process.Close();
 
 ................
 
 private void ToolOutputHandler(object sendingProcess, System.Diagnostics.DataReceivedEventArgs outLine)
         {
             if (richTextBox_Output.InvokeRequired)
             {
                 richTextBox_Output.BeginInvoke(
                         new System.Diagnostics.DataReceivedEventHandler(ToolOutputHandler), new[] { sendingProcess, outLine }
                     );
             }
             else
             {
                 if (outLine.Data != null)
                 {
                     Log(outLine.Data);
                 }
             }
         }
more ▼

answered Jan 20 '16 at 12:56 AM

avatar image

theonecalledtom
1.3k 61 68 271

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question