File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -22,11 +22,17 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2222using System . Text ;
2323using EcuMapTools ;
2424using SharpTuneCore ;
25+ using System . Runtime . InteropServices ;
2526
2627namespace SharpTune
2728{
2829 public static class Program
2930 {
31+ // defines for commandline output
32+ [ DllImport ( "kernel32.dll" ) ]
33+ static extern bool AttachConsole ( int dwProcessId ) ;
34+ private const int ATTACH_PARENT_PROCESS = - 1 ;
35+
3036 private static SharpTuner sharpTuner ;
3137 /// <summary>
3238 /// Entry point. Runs the utility with or without exception handling, depending on whether a debugger is attached.
@@ -45,6 +51,9 @@ public static int Main(string[] args)
4551 {
4652 try
4753 {
54+ // redirect console output to parent process;
55+ // must be before any calls to Console.WriteLine()
56+ AttachConsole ( ATTACH_PARENT_PROCESS ) ;
4857 result = Run ( args ) ;
4958 }
5059 catch ( Exception exception )
You can’t perform that action at this time.
0 commit comments