Skip to content

Commit

Permalink
Fix bug subprocess for Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
oleksis committed Aug 3, 2020
1 parent 897b2c8 commit 0715907
Show file tree
Hide file tree
Showing 9 changed files with 11 additions and 20 deletions.
1 change: 1 addition & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)

### Fixed
- Imports for Internationalization with gettext
- Fix bug subprocess for Windows ([WinError 6] Handler no valid)

### Changed
- Migration to Python 3.*
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@ A cross platform front-end GUI of the popular [youtube-dl](https://rg3.github.io
* [GNU gettext](https://www.gnu.org/software/gettext/)

## Downloads
* [Source (.zip)](https://github.com/oleksis/youtube-dl-gui/archive/v1.0.0-alpha.zip)
* [Source (.tar.gz)](https://github.com/oleksis/youtube-dl-gui/archive/v1.0.0-alpha.tar.gz)
* [Source (.zip)](https://github.com/oleksis/youtube-dl-gui/archive/v1.0.1-alpha.zip)
* [Source (.tar.gz)](https://github.com/oleksis/youtube-dl-gui/archive/v1.0.1-alpha.tar.gz)

## Installation

### Install From Source
* Download & extract the source
* Change directory into *youtube-dl-gui-1.0.0-alpha*
* Change directory into *youtube-dl-gui-1.0.1-alpha*
* Create virtual environment
```
python3 -m venv env
Expand Down
1 change: 0 additions & 1 deletion tests/test_ditem.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

"""Contains test cases for the DownloadItem object."""

from __future__ import unicode_literals

import sys
import os.path
Expand Down
1 change: 0 additions & 1 deletion tests/test_dlist.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

"""Contains test cases for the DownloadList object."""

from __future__ import unicode_literals

import sys
import os.path
Expand Down
1 change: 0 additions & 1 deletion tests/test_parsers.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

"""Contains test cases for the parsers module."""

from __future__ import unicode_literals

import sys
import os.path
Expand Down
1 change: 0 additions & 1 deletion tests/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

"""Contains test cases for the utils.py module."""

from __future__ import unicode_literals

import sys
import os.path
Expand Down
1 change: 0 additions & 1 deletion tests/test_widgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

"""Contains test cases for the widgets.py module."""

from __future__ import unicode_literals

import sys
import os.path
Expand Down
17 changes: 6 additions & 11 deletions youtube_dl_gui/downloaders.py
Original file line number Diff line number Diff line change
Expand Up @@ -318,19 +318,13 @@ def _create_process(self, cmd):
cmd (list): Python list that contains the command to execute.
"""
info = preexec = None

# Keep a unicode copy of cmd for the log
# ucmd = cmd
info = None

if os.name == 'nt':
# Hide subprocess window
info = subprocess.STARTUPINFO()
info.dwFlags |= subprocess.STARTF_USESHOWWINDOW
else:
# Make subprocess the process group leader
# in order to kill the whole process group with os.killpg
preexec = os.setsid
info.wShowWindow = subprocess.SW_HIDE

# Encode command for subprocess
# Refer to http://stackoverflow.com/a/9951851/35070
Expand All @@ -339,10 +333,11 @@ def _create_process(self, cmd):

try:
self._proc = subprocess.Popen(cmd,
stdin=subprocess.PIPE,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
preexec_fn=preexec,
startupinfo=info)
stderr=subprocess.STDOUT,
startupinfo=info,
start_new_session=True)
except (ValueError, OSError, FileNotFoundError) as error:
self._log('Failed to start process: {}'.format(str(cmd)))
self._log(str(error))
Expand Down
2 changes: 1 addition & 1 deletion youtube_dl_gui/version.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# -*- coding: utf-8 -*-


__version__ = '1.0.0'
__version__ = '1.0.1'

0 comments on commit 0715907

Please sign in to comment.