Hacker News new | past | comments | ask | show | jobs | submit login

Not all programs need to fork, obviously.

Programs that fork and immediately exec can be improved under Cygwin by using the spawn, family of system calls, like what I have here:

http://www.kylheku.com/cgit/txr/tree/stream.c

in this source file there is a version of the run function that uses _wspawnvp, support for which is detected in my ./configure script. Well, _wspawnlp, but they're in the same family:

  printf "Checking for _wspawnlp ... "

  cat > conftest.c <<!
  #include "config.h"
  #include <process.h>
  #include <wchar.h>

  int main(int argc, char **argv)
  {
    wchar_t *wargv[] = { L"foo", L"bar", 0 };
    int r = _wspawnlp(_P_WAIT, L"foo", wargv);
    return 0;
  }
  !
  if conftest ; then
    printf "yes\n"
    printf "#define HAVE_WSPAWN 1\n" >> config.h
  else
    printf "no\n"
  fi
The porting experience of Unix and Linux programs to Cygwin is pretty darn good. You can tell just from the large number of packages that are available under Cygwin.

Even programs that use termios to put the TTY in raw mode and use ANSI escape sequences to control the screen work in Cygwin. Cygwin's I/O system contains a layer that translates ANSI codes to Win32 Console API calls. This works inside the Windows CMD.EXE console, not only the Cygwin terminall.




> inside the Windows CMD.EXE console

You have a typo in conhost.exe there. The Windows console has native support for those escape sequences by now too, though.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: