Per linux ho risolto così:
codice:
int uv_system_undo_freopen(UV_FILEINFO *stdout_info, FILE *original_stream) {
if(isNULL(stdout_info)) {
return -1;
}
fflush(original_stream);
#if SYSTEM == LINUX
if(dup2(stdout_info->fd, fileno(original_stream)) == -1) {
perror("UV_SYSTEM_CORE_LINUX => dup2 failed");
return -1;
}
close(stdout_info->fd);
#elif SYSTEM == WIN32
#error "Windows version still in working."
#else
#error "System not supported"
#endif
clearerr(original_stream);
fsetpos(original_stream, &stdout_info->fpos);
return 0;
}
La struttura UV_FILEINFO, contiene solo la posizione e il file descriptor del nuovo stream verso cui viene indirizzato stdout.
Per windows non so' come fare, oregon !!!