openatx / adbutils

pure python adb library for google adb service.
MIT License
736 stars 173 forks source link

Redirect subprocess' stdin to devnull #47

Closed rokm closed 2 years ago

rokm commented 2 years ago

In a PyInstaller-frozen application without console (and onefile bundle), the _is_valid_exe always returns False; the subprocess.check_call() call always fails with OSError: [WinError 6] The handle is invalid because the inherited stdin handle is invalid (due to console being unavailable). Therefore, it should be redirected to devnull, like stdout and stderr are.

Also, use subprocess.DEVNULL instead of manually opening os.devnull.

Fixes part of pyinstaller/pyinstaller#6236.

rokm commented 2 years ago

The same redirect of stdin to devnull is also required in AdbDevice.adb_output.

codeskyblue commented 2 years ago

thanks

codeskyblue commented 2 years ago

merged in 0.11.1