From 6e89eab3801bf8743acf55b521142ff99cda8ba1 Mon Sep 17 00:00:00 2001
From: Michiel Cottaar <MichielCottaar@protonmail.com>
Date: Tue, 2 Apr 2024 15:47:42 +0100
Subject: [PATCH] Remove unused `real_stdout` attribute

The reason for removing this is that pytest sets the `sys.stdout` to some object which cannot be pickled. So, any `test_run.test_wrapper_to_cmd` fails within pytest, even though there is no such problem outside of pytest.
---
 fsl/utils/run.py | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/fsl/utils/run.py b/fsl/utils/run.py
index 97147064..c4848c97 100644
--- a/fsl/utils/run.py
+++ b/fsl/utils/run.py
@@ -53,7 +53,7 @@ DRY_RUN = False
 execute them.
 """
 
-DRY_RUN_COMMANDS = []
+DRY_RUN_COMMANDS = None
 """Contains the commands that got logged during a dry run.
 
 Commands will be logged if :data:`DRY_RUN` is true, which can be set using :func:`dryrun`.
@@ -112,7 +112,6 @@ def prepareArgs(args):
     return list(args)
 
 
-real_stdout = sys.stdout
 def _forwardStream(in_, *outs):
     """Creates and starts a daemon thread which forwards the given input stream
     to one or more output streams. Used by the :func:`run` function to redirect
@@ -275,7 +274,8 @@ def _dryrun(submit, returnStdout, returnStderr, returnExitcode, *args):
 
     # Save command/submit parameters -
     # see the dryrun ctx manager
-    DRY_RUN_COMMANDS.append((args, submit))
+    if DRY_RUN_COMMANDS is not None:
+        DRY_RUN_COMMANDS.append((args, submit))
 
     if submit:
         return ('0',)
-- 
GitLab