Skip to content

Commit

Permalink
fixing a stupid copy/paste mistake in send_to_bg
Browse files Browse the repository at this point in the history
  • Loading branch information
vilemduha committed Sep 26, 2023
1 parent 4f618a1 commit abeb21b
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions blenderkit_server_utils/send_to_bg.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,19 +145,19 @@ def reader_thread(pipe, func):

# Other code remains the same ...

if verbosity_level == 0:
stdout_val, stderr_val = subprocess.PIPE, subprocess.PIPE
elif verbosity_level in {1, 2}:
stdout_val, stderr_val = subprocess.PIPE, subprocess.PIPE
else:
raise ValueError(
"Invalid verbosity level. It must be 0 (silent mode), 1 (only print errors), or 2 (print everything).")

stdout_val, stderr_val = subprocess.PIPE, subprocess.PIPE


with subprocess.Popen(command, stdout=stdout_val, stderr=stderr_val, creationflags=get_process_flags()) as proc:
if verbosity_level == 2:
stdout_thread = threading.Thread(target=reader_thread,
args=(proc.stdout, lambda line: print('STDOUT:', line)))
stderr_thread = threading.Thread(target=reader_thread,
args=(proc.stderr, lambda line: print('STDERR:', line)))
elif verbosity_level == 1:
stdout_thread = threading.Thread(target=reader_thread,
args=(proc.stdout, lambda _: None))
stderr_thread = threading.Thread(target=reader_thread,
args=(proc.stderr, lambda line: print('STDERR:', line)))
else:
Expand Down

0 comments on commit abeb21b

Please sign in to comment.