[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[PATCH] stdout and stderr may also need to be created.



This is required when handling kickstart scriptlets that can write to
log files, since the log file will need to be created before it can
be opened.
---
 iutil.py |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/iutil.py b/iutil.py
index a508219..d9e8a77 100644
--- a/iutil.py
+++ b/iutil.py
@@ -65,14 +65,14 @@ def execWithRedirect(command, argv, stdin = None, stdout = None,
         stdin = sys.stdin.fileno()
 
     if isinstance(stdout, str):
-        stdout = os.open(stdout, os.O_RDWR)
+        stdout = os.open(stdout, os.O_RDWR|os.O_CREAT)
     elif isinstance(stdout, int):
         pass
     elif stdout is None or not isinstance(stdout, file):
         stdout = sys.stdout.fileno()
 
     if isinstance(stderr, str):
-        stderr = os.open(stderr, os.O_RDWR)
+        stderr = os.open(stderr, os.O_RDWR|os.O_CREAT)
     elif isinstance(stderr, int):
         pass
     elif stderr is None or not isinstance(stderr, file):
@@ -135,7 +135,7 @@ def execWithCapture(command, argv, stdin = None, stderr = None, root='/'):
         stdin = sys.stdin.fileno()
 
     if isinstance(stderr, str):
-        stderr = os.open(stderr, os.O_RDWR)
+        stderr = os.open(stderr, os.O_RDWR|os.O_CREAT)
     elif isinstance(stderr, int):
         pass
     elif stderr is None or not isinstance(stderr, file):
@@ -184,14 +184,14 @@ def execWithPulseProgress(command, argv, stdin = None, stdout = None,
         stdin = sys.stdin.fileno()
 
     if isinstance(stdout, str):
-        stdout = os.open(stdout, os.O_RDWR)
+        stdout = os.open(stdout, os.O_RDWR|os.O_CREAT)
     elif isinstance(stdout, int):
         pass
     elif stdout is None or not isinstance(stdout, file):
         stdout = sys.stdout.fileno()
 
     if isinstance(stderr, str):
-        stderr = os.open(stderr, os.O_RDWR)
+        stderr = os.open(stderr, os.O_RDWR|os.O_CREAT)
     elif isinstance(stderr, int):
         pass
     elif stderr is None or not isinstance(stderr, file):
-- 
1.6.1.3


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]