Author: rfm
Date: Sun Apr 27 11:18:55 2014
New Revision: 37815
URL: http://svn.gna.org/viewcvs/gnustep?rev=37815&view=rev
Log:
don't close log file if it's stderr
Modified:
libs/ec/trunk/EcProcess.m
Modified: libs/ec/trunk/EcProcess.m
URL:
http://svn.gna.org/viewcvs/gnustep/libs/ec/trunk/EcProcess.m?rev=37815&r1=37814&r2=37815&view=diff
==============================================================================
--- libs/ec/trunk/EcProcess.m (original)
+++ libs/ec/trunk/EcProcess.m Sun Apr 27 11:18:55 2014
@@ -1311,40 +1311,48 @@
hdl = [cmdLogMap objectForKey: name];
if (hdl != nil)
{
- NSString *path;
- NSDictionary *attr;
- NSFileManager *mgr;
-
- /*
- * Ensure that all data is written to file.
+ /* Ensure that all data is written to file.
*/
fflush(stderr);
- [hdl closeFile];
-
- /*
- * If the file is empty, remove it, otherwise move to archive directory.
+
+ /* If we are writing to stderr, we can't close the file handle
+ * and move the underlying file.
*/
- path = [cmdLogsDir(nil) stringByAppendingPathComponent: name];
- mgr = [NSFileManager defaultManager];
- attr = [mgr fileAttributesAtPath: path traverseLink: NO];
- if ([[attr objectForKey: NSFileSize] intValue] == 0)
- {
- [mgr removeFileAtPath: path handler: nil];
- }
+ if ([NSFileHandle fileHandleWithStandardError] != hdl)
+ {
+ [hdl closeFile];
+ }
else
- {
- NSDate *when;
- NSString *where;
-
- when = [NSDate date];
- where = [when descriptionWithCalendarFormat: @"%Y-%m-%d"
- timeZone: nil locale: nil];
- if (where != nil)
- {
- [self _moveLog: name to: where];
- }
- }
-
+ {
+ NSString *path;
+ NSDictionary *attr;
+ NSFileManager *mgr;
+
+
+ /* If the file is empty, remove it,
+ * otherwise move to archive directory.
+ */
+ path = [cmdLogsDir(nil) stringByAppendingPathComponent: name];
+ mgr = [NSFileManager defaultManager];
+ attr = [mgr fileAttributesAtPath: path traverseLink: NO];
+ if ([[attr objectForKey: NSFileSize] intValue] == 0)
+ {
+ [mgr removeFileAtPath: path handler: nil];
+ }
+ else
+ {
+ NSDate *when;
+ NSString *where;
+
+ when = [NSDate date];
+ where = [when descriptionWithCalendarFormat: @"%Y-%m-%d"
+ timeZone: nil locale: nil];
+ if (where != nil)
+ {
+ [self _moveLog: name to: where];
+ }
+ }
+ }
/*
* Unregister filename.
*/
_______________________________________________
Gnustep-cvs mailing list
[email protected]
https://mail.gna.org/listinfo/gnustep-cvs