Skip to content

Commit

Permalink
[websocket/nodejs] check package in safer way
Browse files Browse the repository at this point in the history
  • Loading branch information
Lesmiscore committed Dec 24, 2021
1 parent 9d608e3 commit 4fd7c59
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions yt_dlp/websocket/nodejs.py
Expand Up @@ -33,9 +33,7 @@ def start_node_process(args):
def test_package_existence(pkg):
try:
assert isinstance(pkg, compat_str)
p = start_node_process(['-e', 'require("%s")' % pkg])
p.wait()
return p.returncode == 0
return start_node_process(['-e', f'require({json.dumps(pkg)})']).wait() == 0
except OSError:
return False

Expand Down

0 comments on commit 4fd7c59

Please sign in to comment.