Author: rfm
Date: Thu Mar 26 12:33:02 2015
New Revision: 38434
URL: http://svn.gna.org/viewcvs/gnustep?rev=38434&view=rev
Log:
Add some fine control over standard IO stream handling
Modified:
libs/ec/trunk/ChangeLog
libs/ec/trunk/Control.plist
libs/ec/trunk/EcCommand.m
libs/ec/trunk/EcProcess.h
libs/ec/trunk/EcProcess.m
Modified: libs/ec/trunk/ChangeLog
URL:
http://svn.gna.org/viewcvs/gnustep/libs/ec/trunk/ChangeLog?rev=38434&r1=38433&r2=38434&view=diff
==============================================================================
--- libs/ec/trunk/ChangeLog (original)
+++ libs/ec/trunk/ChangeLog Thu Mar 26 12:33:02 2015
@@ -1,3 +1,16 @@
+2015-03-26 Richard Frith-Macdonald <[email protected]>
+
+ * Control.plist:
+ * EcCommand.m:
+ * EcProcess.h:
+ * EcProcess.m:
+ New options for dealing with I/O. In EcProcess we can set
+ EcKeepStandardError to keep the stderr stream separate from the
+ debug logging file.
+ When a process is launched from the Command server, we can define
+ KeepStandardInput, KeepStandardOutput, and KeepStandardError flags
+ in the task info to stop the standard streams from being closed.
+
2015-03-19 Richard Frith-Macdonald <[email protected]>
* EcProcess.m:
Modified: libs/ec/trunk/Control.plist
URL:
http://svn.gna.org/viewcvs/gnustep/libs/ec/trunk/Control.plist?rev=38434&r1=38433&r2=38434&view=diff
==============================================================================
--- libs/ec/trunk/Control.plist (original)
+++ libs/ec/trunk/Control.plist Thu Mar 26 12:33:02 2015
@@ -41,6 +41,9 @@
Home = "~xxx/Test"; // Directory to run in
Args = ("-Debug", "YES"); // Args to launch with
Auto = NO; // Auto-launch?
+ KeepStandardInput = YES; // Don't close stdin
+ KeepStandardOutput = YES; // Don't close stdout
+ KeepStandardError = YES; // Don't close stderr
};
Bar = {
Prog = "Bar"; // RName of binary
Modified: libs/ec/trunk/EcCommand.m
URL:
http://svn.gna.org/viewcvs/gnustep/libs/ec/trunk/EcCommand.m?rev=38434&r1=38433&r2=38434&view=diff
==============================================================================
--- libs/ec/trunk/EcCommand.m (original)
+++ libs/ec/trunk/EcCommand.m Thu Mar 26 12:33:02 2015
@@ -1965,9 +1965,26 @@
}
if (prog != nil)
{
- [task setStandardInput: hdl];
- [task setStandardOutput: hdl];
- [task setStandardError: hdl];
+ NSString *s;
+
+ s = [taskInfo objectForKey: @"KeepStandardInput"];
+ if (NO == [s respondsToSelector: @selector(boolValue)]
+ || NO == [s boolValue])
+ {
+ [task setStandardInput: hdl];
+ }
+ s = [taskInfo objectForKey: @"KeepStandardOutput"];
+ if (NO == [s respondsToSelector: @selector(boolValue)]
+ || NO == [s boolValue])
+ {
+ [task setStandardOutput: hdl];
+ }
+ s = [taskInfo objectForKey: @"KeepStandardError"];
+ if (NO == [s respondsToSelector: @selector(boolValue)]
+ || NO == [s boolValue])
+ {
+ [task setStandardError: hdl];
+ }
if (home != nil && [home length] > 0)
{
[task setCurrentDirectoryPath: home];
Modified: libs/ec/trunk/EcProcess.h
URL:
http://svn.gna.org/viewcvs/gnustep/libs/ec/trunk/EcProcess.h?rev=38434&r1=38433&r2=38434&view=diff
==============================================================================
--- libs/ec/trunk/EcProcess.h (original)
+++ libs/ec/trunk/EcProcess.h Thu Mar 26 12:33:02 2015
@@ -75,6 +75,14 @@
it is used to trigger earlier shutdown once the specified
number of open file descriptors has been reached, rather
than waiting for the operating system imposed limit.
+ </desc>
+ <term>EcKeepStandardError</term>
+ <desc>
+ This boolean value determines whether the standard error output
+ should be kept as it is on process startup, or should be merged
+ with the local debug log to file.<br />
+ The default (EcKeepStandardError set to NO) is to merge the
+ standard error logging with the debug logging.
</desc>
<term>EcMemory</term>
<desc>
Modified: libs/ec/trunk/EcProcess.m
URL:
http://svn.gna.org/viewcvs/gnustep/libs/ec/trunk/EcProcess.m?rev=38434&r1=38433&r2=38434&view=diff
==============================================================================
--- libs/ec/trunk/EcProcess.m (original)
+++ libs/ec/trunk/EcProcess.m Thu Mar 26 12:33:02 2015
@@ -123,6 +123,7 @@
static BOOL cmdFlagTesting = NO;
static BOOL cmdIsQuitting = NO;
static BOOL cmdIsRunning = NO;
+static BOOL cmdKeepStderr = NO;
static NSInteger cmdQuitStatus = 0;
static NSString *cmdInst = nil;
static NSString *cmdName = nil;
@@ -1514,7 +1515,7 @@
* As a special case, if this is the default debug file
* we must set it up to write to stderr.
*/
- if ([name isEqual: cmdDebugName] == YES)
+ if (NO == cmdKeepStderr && [name isEqual: cmdDebugName] == YES)
{
int desc;
@@ -3740,6 +3741,11 @@
[cmdDefs registerDefaults: defs];
}
}
+
+ /* See if we should keep stderr separate, or merge it with
+ * our debug output (the default).
+ */
+ cmdKeepStderr = [cmdDefs boolForKey: @"KeepStandardError"];
if (nil == noNetConfig)
{
_______________________________________________
Gnustep-cvs mailing list
[email protected]
https://mail.gna.org/listinfo/gnustep-cvs