lib/standard/stream: Renamed streams for more explicit denomination
[nit.git] / lib / standard / exec.nit
index 150ed48..13cd7a0 100644 (file)
@@ -15,7 +15,7 @@
 # Standard input and output can be handled through streams.
 module exec
 
-import stream
+import file
 
 # Simple sub-process
 class Process
@@ -48,8 +48,7 @@ class Process
        var arguments: nullable Array[String]
 
        # Launch a command with some arguments
-       init(command: String, arguments: String...)
-       do
+       init(command: String, arguments: String...) is old_style_init do
                self.command = command
                self.arguments = arguments
                execute
@@ -89,10 +88,12 @@ class Process
 end
 
 # stdout of the process is readable
-class IProcess
+class ProcessReader
        super Process
-       super IStream
-       var stream_in: FDIStream is noinit
+       super Reader
+
+       # File Descriptor used for the input.
+       var stream_in: FileReader is noinit
 
        redef fun close do stream_in.close
 
@@ -105,15 +106,17 @@ class IProcess
        redef fun execute
        do
                super
-               stream_in = new FDIStream(data.out_fd)
+               stream_in = new FileReader.from_fd(data.out_fd)
        end
 end
 
 # stdin of the process is writable
-class OProcess
+class ProcessWriter
        super Process
-       super OStream
-       var stream_out: OStream is noinit
+       super Writer
+
+       # File Descriptor used for the output.
+       var stream_out: Writer is noinit
 
        redef fun close do stream_out.close
 
@@ -126,15 +129,15 @@ class OProcess
        redef fun execute
        do
                super
-               stream_out = new FDOStream(data.in_fd)
+               stream_out = new FileWriter.from_fd(data.in_fd)
        end
 end
 
 # stdin and stdout are both accessible
-class IOProcess
-       super IProcess
-       super OProcess
-       super IOStream
+class ProcessDuplex
+       super ProcessReader
+       super ProcessWriter
+       super Duplex
 
        redef fun close
        do
@@ -159,6 +162,9 @@ redef class Sys
 end
 
 redef class NativeString
+       # Execute self as a shell command.
+       #
+       # See the posix function system(3).
        fun system: Int is extern "string_NativeString_NativeString_system_0"
 end