Skip to content

Commit

Permalink
Fixes OSError: [WinError 6] The handle is invalid
Browse files Browse the repository at this point in the history
  • Loading branch information
crsib committed Dec 19, 2023
1 parent 03d4874 commit 74af42b
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion conan/conan_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ def migrate(args):
'--profile:host', host_profile,
]

subprocess.check_call(conan_options)
subprocess.check_call(conan_options, stdin=subprocess.DEVNULL)

with open(args_file_path, 'w') as args_file:
args_file.write(args_string)
2 changes: 1 addition & 1 deletion conan/conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def global_copy_files(conanfile, dependency_info):
copied_files = copy(conanfile, "*.so*", dependency_info.cpp_info.libdirs[0], f"{conanfile.build_folder}/{lib_dir}")
for file in copied_files:
if not os.path.islink(file):
subprocess.check_call([patchelf_path, "--add-rpath", "$ORIGIN", file])
subprocess.check_call([patchelf_path, "--add-rpath", "$ORIGIN", file], stdin=subprocess.DEVNULL)

# Dataclass that holds the information about a dependency
@dataclass
Expand Down
6 changes: 3 additions & 3 deletions conan/helpers/conan_environment.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ class ConanVenvBuilder(venv.EnvBuilder):
def post_setup(self, context):
with ConanEnv(context.env_dir):
cmd = [get_python(), '-m', 'pip', 'install', 'conan']
subprocess.check_call(cmd)
subprocess.check_call(cmd, stdin=subprocess.DEVNULL)


def get_conan():
Expand All @@ -87,14 +87,14 @@ def get_conan():

def get_conan_version():
try:
version_string = subprocess.check_output([get_conan(), '--version']).decode('utf-8').strip()
version_string = subprocess.check_output([get_conan(), '--version'], stdin=subprocess.DEVNULL).decode('utf-8').strip()
return version_tuple(version_string.split(' ')[-1])
except FileNotFoundError:
return None


def upgrade_conan():
subprocess.check_call([get_python(), '-m', 'pip', 'install', '--upgrade', 'conan'])
subprocess.check_call([get_python(), '-m', 'pip', 'install', '--upgrade', 'conan'], stdin=subprocess.DEVNULL)
return get_conan_version()


Expand Down
8 changes: 4 additions & 4 deletions conan/helpers/remotes.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from helpers.conan_environment import get_conan

def list_remotes():
remotes = subprocess.check_output([get_conan(), 'remote', 'list', '--format', 'json']).decode('utf-8')
remotes = subprocess.check_output([get_conan(), 'remote', 'list', '--format', 'json'], stdin=subprocess.DEVNULL).decode('utf-8')
return json.loads(remotes)


Expand All @@ -13,7 +13,7 @@ def remove_remote(remote_name:str):
for remote in remotes:
if remote['name'] != remote_name:
continue
return subprocess.check_call([get_conan(), 'remote', 'remove', remote_name])
return subprocess.check_call([get_conan(), 'remote', 'remove', remote_name], stdin=subprocess.DEVNULL)


def add_remote(name:str, url:str) -> None:
Expand All @@ -22,10 +22,10 @@ def add_remote(name:str, url:str) -> None:
if remote['name'] != name:
continue
if remote['url'] != url:
subprocess.check_call([get_conan(), 'remote', 'update', '--url', name])
subprocess.check_call([get_conan(), 'remote', 'update', '--url', name], stdin=subprocess.DEVNULL)
return

subprocess.check_call([get_conan(), 'remote', 'add', name, url])
subprocess.check_call([get_conan(), 'remote', 'add', name, url], stdin=subprocess.DEVNULL)


def validate_remotes():
Expand Down

0 comments on commit 74af42b

Please sign in to comment.