Merge: Newstreams
[nit.git] / lib / standard / exec.nit
index 150ed48..79f9bfd 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
@@ -92,7 +91,9 @@ end
 class IProcess
        super Process
        super IStream
-       var stream_in: FDIStream is noinit
+
+       # File Descriptor used for the input.
+       var stream_in: IFStream is noinit
 
        redef fun close do stream_in.close
 
@@ -105,7 +106,7 @@ class IProcess
        redef fun execute
        do
                super
-               stream_in = new FDIStream(data.out_fd)
+               stream_in = new IFStream.from_fd(data.out_fd)
        end
 end
 
@@ -113,6 +114,8 @@ end
 class OProcess
        super Process
        super OStream
+
+       # File Descriptor used for the output.
        var stream_out: OStream is noinit
 
        redef fun close do stream_out.close
@@ -126,7 +129,7 @@ class OProcess
        redef fun execute
        do
                super
-               stream_out = new FDOStream(data.in_fd)
+               stream_out = new OFStream.from_fd(data.in_fd)
        end
 end
 
@@ -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