The compiler under DOS does not intercept all errors?

DOS specific questions.
Post Reply
VANYA
Posts: 1839
Joined: Oct 24, 2010 15:16
Location: Ярославль
Contact:

The compiler under DOS does not intercept all errors?

Post by VANYA »

Hi ALL!

I compiled the source code here with a library written in C.
I noticed that the compiler displays only its own errors, and the linker itself displays errors related to the linker. That is, I cannot catch these errors using Open Pipe. Does the compiler under DOS not catch errors from other tools that it calls?
marcov
Posts: 3465
Joined: Jun 16, 2005 9:45
Location: Netherlands
Contact:

Re: The compiler under DOS does not intercept all errors?

Post by marcov »

Errors are probably on stderr, not just stdout. Maybe your piping setup doesn't catch stderr (error on dos iirc)
VANYA
Posts: 1839
Joined: Oct 24, 2010 15:16
Location: Ярославль
Contact:

Re: The compiler under DOS does not intercept all errors?

Post by VANYA »

marcov wrote: Nov 11, 2022 10:56 Errors are probably on stderr, not just stdout. Maybe your piping setup doesn't catch stderr (error on dos iirc)
No, you did not understand.

Here we take the usual source file:

Code: Select all

Const TEST_COMMAND = "fbc test.bas"

Open Pipe TEST_COMMAND For Input As #1

Dim As String ln
Do Until EOF(1)
    Line Input #1, ln
    Print ln
Loop

Close #1
On systems linux and windows this program prints all errors (compiler errors + assembly errors + link errors), if any, of course. On a DOS system, only compiler errors are displayed.
VANYA
Posts: 1839
Joined: Oct 24, 2010 15:16
Location: Ярославль
Contact:

Re: The compiler under DOS does not intercept all errors?

Post by VANYA »

In DOS I tried:

Code: Select all

Open Pipe "fbc test.bas" For Input As #1
only outputs compilation errors. All other errors are written to the console, not to the pipe

Code: Select all

Open Pipe "fbc test.bas 2>&1" For Input As #1
creates file $1 and writes there:

error 81: Invalid command-line option, "2"

On windows and linux the line "fbc test.bas 2>&1" works correctly.
Why doesn't it work in DOS?
marcov
Posts: 3465
Joined: Jun 16, 2005 9:45
Location: Netherlands
Contact:

Re: The compiler under DOS does not intercept all errors?

Post by marcov »

VANYA
Posts: 1839
Joined: Oct 24, 2010 15:16
Location: Ярославль
Contact:

Re: The compiler under DOS does not intercept all errors?

Post by VANYA »

Did I understand correctly?
In DOS, programs can't receive another program's errors in their buffer? Errors are displayed only in the console?
And the second question: what is iirc ?
marcov
Posts: 3465
Joined: Jun 16, 2005 9:45
Location: Netherlands
Contact:

Re: The compiler under DOS does not intercept all errors?

Post by marcov »

VANYA wrote: Nov 13, 2022 11:39 Did I understand correctly?
In DOS, programs can't receive another program's errors in their buffer? Errors are displayed only in the console?
Afaik it means that at least command.com doesn't support the piping syntax, but programs maybe can do it.
And the second question: what is iirc ?
Common Fido/usenet/internet abbrevs.

IIRC= If I Recall Correctly
Afaik = As far as I know.
Last edited by marcov on Nov 13, 2022 14:20, edited 1 time in total.
VANYA
Posts: 1839
Joined: Oct 24, 2010 15:16
Location: Ярославль
Contact:

Re: The compiler under DOS does not intercept all errors?

Post by VANYA »

Thanks for answers!
caseih
Posts: 2159
Joined: Feb 26, 2007 5:32

Re: The compiler under DOS does not intercept all errors?

Post by caseih »

You could try the FreeDOS command replacement, FreeCom. It may support modern features like stderr piping.
VANYA
Posts: 1839
Joined: Oct 24, 2010 15:16
Location: Ярославль
Contact:

Re: The compiler under DOS does not intercept all errors?

Post by VANYA »

caseih wrote: Nov 13, 2022 18:14 You could try the FreeDOS command replacement, FreeCom. It may support modern features like stderr piping.
I'm in freedos and running. That is, by default, this is exactly the behavior as I described. I just thought that it was the compiler not redirecting errors, but it turned out that this is typical behavior in DOS
Post Reply