Skip to content

Add --background support for Windows

Suhas K S requested to merge suhasks123/wget2:WIN32backgroundSupport into master

Design:

--background for non-windows operating systems is implemented using fork(). Windows doesn't have fork() so a workaround needs to be followed to implement --background on it. The src/mswindows.c in wget1.x has a reliable method to achieve this.

Essentially, CreateProcess() in windows can be used to create a new wget2 process with the same command line parameters(except --background) used to run the current running wget2 process. The new process is run without a console and suspended till the current running wget2 process is terminated. The console output is printed into a file wget-log in the same directory.

Approver's checklist:

  • The author has submitted the FSF Copyright Assignment and is listed in AUTHORS
  • There is a test suite reasonably covering new functionality or modifications
  • Function naming, parameters, return values, types, etc., are consistent with existing code
  • This feature/change has adequate documentation added (if appropriate)
  • No obvious mistakes / misspelling in the code

Merge request reports