This method should work for all the UNIX-like systems, as this behavior is defined by POSIX IIRC. As for Windows, it also appears to do the same thing. I wrote a simple C program that is compiled with mingw to test this:
Code: Select all
#include <stdio.h>
int main()
{
fprintf(stdout, "Standard Output\n");
fprintf(stderr, "Standard Error\n");
return 0;
}
After compiling it as "text.exe", I proceed to test it at the newLISP prompt:
Code: Select all
newLISP v.10.6.0 32-bit on Win32 IPv4/6 libffi, options: newlisp -h
> (exec {test.exe})
Standard Error
("Standard Output")
> (exec {test.exe 2>&1})
("Standard Output" "Standard Error")
> (exit)
It appears through my tests that windows also redirects standard error to standard output in this case, using the same syntax for redirection as UNIX shells. Notice how in the first usage newLISP does not include the output sent to standard error in the return value of exec, but it does in the second usage when you append " 2>&1". I hope this helps.