digitalmars.D.learn - Get Compile Errors - Command Line
- Bauss (5/5) Mar 14 2014 When compiling manual through command line is there anyway to get
- bearophile (5/10) Mar 14 2014 Probably you have to use redirect to file, with > or even 2> on
- Bauss (2/13) Mar 14 2014 I'm using dmd.exe and not cmd.exe
- Chris Williams (4/5) Mar 14 2014 dmd.exe doesn't have a GUI. You're probably running dmd.exe
- Bauss (4/9) Mar 15 2014 dmd.exe is a console application. And I running dmd.exe with
- =?UTF-8?B?QWxpIMOHZWhyZWxp?= (7/20) Mar 15 2014 Sorry but that has nothing to do with the solution that has already been...
- Bauss (5/28) Mar 15 2014 Doesn't work.
- =?UTF-8?B?QWxpIMOHZWhyZWxp?= (7/11) Mar 15 2014 Your first sentence had "compiling manual through command line" in it
- Adam D. Ruppe (39/41) Mar 15 2014 Skip to the bottom of this message if you are doing it in D and
- Bauss (3/44) Mar 16 2014 Actually I was doing it through C#. I have tried getting the
- Adam D. Ruppe (9/11) Mar 16 2014 Did you try the startup info there too? Here's a link with a .net
- Bauss (3/15) Mar 16 2014 Thank you! That was the issue. I was reading from the
When compiling manual through command line is there anyway to get the compiling errors? Something like an error.log file or whatever. Perhaps an argument for the compiler? I checked the documents but didn't seem like there was anything. Thanks.
Mar 14 2014
Bauss:When compiling manual through command line is there anyway to get the compiling errors? Something like an error.log file or whatever. Perhaps an argument for the compiler? I checked the documents but didn't seem like there was anything. Thanks.Probably you have to use redirect to file, with > or even 2> on Windows. Bye, bearophile
Mar 14 2014
On Friday, 14 March 2014 at 16:58:09 UTC, bearophile wrote:Bauss:I'm using dmd.exe and not cmd.exeWhen compiling manual through command line is there anyway to get the compiling errors? Something like an error.log file or whatever. Perhaps an argument for the compiler? I checked the documents but didn't seem like there was anything. Thanks.Probably you have to use redirect to file, with > or even 2> on Windows. Bye, bearophile
Mar 14 2014
On Friday, 14 March 2014 at 17:10:46 UTC, Bauss wrote:I'm using dmd.exe and not cmd.exedmd.exe doesn't have a GUI. You're probably running dmd.exe inside cmd.exe. dmd foo.d > mylog.txt
Mar 14 2014
On Saturday, 15 March 2014 at 02:05:26 UTC, Chris Williams wrote:On Friday, 14 March 2014 at 17:10:46 UTC, Bauss wrote:dmd.exe is a console application. And I running dmd.exe with arguments not cmd.exe with arguments, just wanted to know if there perhaps was an alternative than using cmd.exe.I'm using dmd.exe and not cmd.exedmd.exe doesn't have a GUI. You're probably running dmd.exe inside cmd.exe. dmd foo.d > mylog.txt
Mar 15 2014
On 03/15/2014 03:04 AM, Bauss wrote:On Saturday, 15 March 2014 at 02:05:26 UTC, Chris Williams wrote:And every console supports what you need.On Friday, 14 March 2014 at 17:10:46 UTC, Bauss wrote:dmd.exe is a console application.I'm using dmd.exe and not cmd.exedmd.exe doesn't have a GUI. You're probably running dmd.exe inside cmd.exe. dmd foo.d > mylog.txtAnd I running dmd.exe with arguments not cmd.exe with arguments,Sorry but that has nothing to do with the solution that has already been proposed.just wanted to know if there perhaps was an alternative than using cmd.exe.All you need to do is to try the solution. :) Once again: dmd foo.d 2> error.log Ali
Mar 15 2014
On Saturday, 15 March 2014 at 16:08:06 UTC, Ali Çehreli wrote:On 03/15/2014 03:04 AM, Bauss wrote:Doesn't work. Note I am not typing the arguments, but rather starting the process. Tried both with cmd.exe and dmd.exe and neither seem to work.On Saturday, 15 March 2014 at 02:05:26 UTC, Chris Williamswrote:insideOn Friday, 14 March 2014 at 17:10:46 UTC, Bauss wrote:I'm using dmd.exe and not cmd.exedmd.exe doesn't have a GUI. You're probably running dmd.exeAnd every console supports what you need.cmd.exe. dmd foo.d > mylog.txtdmd.exe is a console application.And I running dmd.exe with arguments not cmd.exe with arguments,Sorry but that has nothing to do with the solution that has already been proposed.just wanted to know if there perhaps was an alternative than using cmd.exe.All you need to do is to try the solution. :) Once again: dmd foo.d 2> error.log Ali
Mar 15 2014
On 03/15/2014 12:11 PM, Bauss wrote:On Saturday, 15 March 2014 at 16:08:06 UTC, Ali Çehreli wrote:What happens?dmd foo.d 2> error.logDoesn't work.Note I am not typing the arguments, but rather starting the process.Your first sentence had "compiling manual through command line" in it and that made us think that you were typing the arguments. You had said: "When compiling manual through command line is there anyway to get the compiling errors?" Ali
Mar 15 2014
On Saturday, 15 March 2014 at 19:11:38 UTC, Bauss wrote:Note I am not typing the arguments, but rather starting the process.Skip to the bottom of this message if you are doing it in D and don't care how it is done in the lower level api. The CreateProcess API call takes a STARTUPINFO argument which has handles you can use to redirect the output. 2>somefile.txt in cmd.exe does something like this: HANDLE hFile = CreateFile("somefile.txt", GENERIC_WRITE, 0, null, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, null); if(hFile == INVALID_HANDLE_VALUE) throw new Exception("couldn't open file"); scope(exit) CloseHandle(hFile); STARTUPINFO si; si.cb = si.sizeof; si.dwFlags = STARTF_USESTDHANDLES; si.hStdError = hFile; // redirect to our file si.hStdInput = GetStdHandle(STD_INPUT_HANDLE); si.hStdOutput = GetStdHandle(STD_OUTPUT_HANDLE); // Now, we'll create the process with the file set up and wait for it to finish PROCESS_INFORMATION pi; if(CreateProcessA("dmd.exe", "dmd.exe yourfile.d", null, null, true, 0, null, null, &si, &pi) == 0) throw new Exception("createProcess failed"); WaitForSingleObject(pi.hProcess, INFINITE); CloseHandle(pi.hProcess); // At this point, we could check out somefile.txt to see what is there Of course, if we wanted to see the content in our program, instead of going through a regular file, we could use CreatePipe() to make a pair, passing the write handle to it as the hStdOutput, then reading from the read side to collect all the program's output in memory. There's similar Posix functions if you want to do this kind of thing on linux, etc., too. If you're writing this program in D, the standard library contains a nice little function to make this a lot shorter: the example there calls dmd too! So if you wanna try it from D, copy/paste that example and it should get you started.
Mar 15 2014
On Saturday, 15 March 2014 at 22:48:52 UTC, Adam D. Ruppe wrote:On Saturday, 15 March 2014 at 19:11:38 UTC, Bauss wrote:output of the window but it doesn't seem to redirect it.Note I am not typing the arguments, but rather starting the process.Skip to the bottom of this message if you are doing it in D and don't care how it is done in the lower level api. The CreateProcess API call takes a STARTUPINFO argument which has handles you can use to redirect the output. 2>somefile.txt in cmd.exe does something like this: HANDLE hFile = CreateFile("somefile.txt", GENERIC_WRITE, 0, null, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, null); if(hFile == INVALID_HANDLE_VALUE) throw new Exception("couldn't open file"); scope(exit) CloseHandle(hFile); STARTUPINFO si; si.cb = si.sizeof; si.dwFlags = STARTF_USESTDHANDLES; si.hStdError = hFile; // redirect to our file si.hStdInput = GetStdHandle(STD_INPUT_HANDLE); si.hStdOutput = GetStdHandle(STD_OUTPUT_HANDLE); // Now, we'll create the process with the file set up and wait for it to finish PROCESS_INFORMATION pi; if(CreateProcessA("dmd.exe", "dmd.exe yourfile.d", null, null, true, 0, null, null, &si, &pi) == 0) throw new Exception("createProcess failed"); WaitForSingleObject(pi.hProcess, INFINITE); CloseHandle(pi.hProcess); // At this point, we could check out somefile.txt to see what is there Of course, if we wanted to see the content in our program, instead of going through a regular file, we could use CreatePipe() to make a pair, passing the write handle to it as the hStdOutput, then reading from the read side to collect all the program's output in memory. There's similar Posix functions if you want to do this kind of thing on linux, etc., too. If you're writing this program in D, the standard library contains a nice little function to make this a lot shorter: the example there calls dmd too! So if you wanna try it from D, copy/paste that example and it should get you started.
Mar 16 2014
On Sunday, 16 March 2014 at 13:57:42 UTC, Bauss wrote:output of the window but it doesn't seem to redirect it.Did you try the startup info there too? Here's a link with a .net example: http://stackoverflow.com/questions/4291912/process-start-how-to-get-the-output Notice that the answer itself only redirects the output, but dmd I believe uses the error stream for it. The comments discuss it: add to the ctor: RedirectStandardError = true, and read from proc.StandardError afterward.
Mar 16 2014
On Sunday, 16 March 2014 at 18:45:30 UTC, Adam D. Ruppe wrote:On Sunday, 16 March 2014 at 13:57:42 UTC, Bauss wrote:Thank you! That was the issue. I was reading from the standardoutput and not standarderroroutput of the window but it doesn't seem to redirect it.Did you try the startup info there too? Here's a link with a .net example: http://stackoverflow.com/questions/4291912/process-start-how-to-get-the-output Notice that the answer itself only redirects the output, but dmd I believe uses the error stream for it. The comments discuss it: add to the ctor: RedirectStandardError = true, and read from proc.StandardError afterward.
Mar 16 2014