The notion of a file-like objects serves as an interface
for read/write operations in python. However, this interface
contains optional parts, like the fileno() function; in fact,
file-like objects not having a real file descriptor explicitly
should not provide this method. As, RunCmd, by indirectly
calling subprocess.Popen, relies input_fd providing fileno(),
not all file-like objects can be passed as argument for
input_fd (e.g., StringIO objects cannot). Change the doc string
to be precise about this.

Signed-off-by: Klaus Aehlig <[email protected]>
---
 lib/utils/process.py | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/lib/utils/process.py b/lib/utils/process.py
index 268ff54..5933929 100644
--- a/lib/utils/process.py
+++ b/lib/utils/process.py
@@ -185,7 +185,8 @@ def RunCmd(cmd, env=None, output=None, cwd="/", 
reset_env=False,
   @type noclose_fds: list
   @param noclose_fds: list of additional (fd >=3) file descriptors to leave
                       open for the child process
-  @type input_fd: C{file}-like object or numeric file descriptor
+  @type input_fd: C{file}-like object containing an actual file descriptor
+                  or numeric file descriptor
   @param input_fd: File descriptor for process' standard input
   @type postfork_fn: Callable receiving PID as parameter
   @param postfork_fn: Callback run after fork but before timeout
@@ -526,7 +527,8 @@ def _RunCmdPipe(cmd, env, via_shell, cwd, interactive, 
timeout, noclose_fds,
   @type noclose_fds: list
   @param noclose_fds: list of additional (fd >=3) file descriptors to leave
                       open for the child process
-  @type input_fd: C{file}-like object or numeric file descriptor
+  @type input_fd: C{file}-like object containing an actual file descriptor
+                  or numeric file descriptor
   @param input_fd: File descriptor for process' standard input
   @type postfork_fn: Callable receiving PID as parameter
   @param postfork_fn: Function run after fork but before timeout
-- 
2.5.0.457.gab17608

Reply via email to