• Modules
    • By category
    • By name
    • Most popular
    • Most downloaded
    • Repository
  • Register
  • Log in
  • Help
    • Start using Ceylon Herd
    • Publish your first module
    • Module publishing guidelines
    • All about Ceylon
    • Keyboard Shortcuts

    • s Focus search module bar
      ? Open this information panel
      j Move selection down
      k Move selection up
      enter Open current selection
Module info
Name
gavin / ceylon.process / 1.3.3
Ceylon Process Platform Module
Category SDK

The Ceylon SDK

Backends JVM
Maven coordinates org.ceylon-lang:ceylon.process
Compatible Ceylon release JVM: 1.2.x, 1.3.x (latest)
Published Aug 21, 2017
Stats Downloads (JVM): 464
Source downloads: 518
Authors Gavin King
Description

API for running native commands in a child process. Clients simply create Processes using the createProcess() method. The new process starts executing immediately.

Process process = createProcess { 
    command = "ls";
    arguments = ["-l"];
    path = home;
};

By default, the standard input, output, and error streams of the new child process are piped to and from the current process by exposing a Writer and Readers.

if (is Reader reader = process.output) {
    while (exists line = reader.readLine()) {
        print(line);
    }
}

The standard input, output, and error streams may be redirected by specifying an Input or Output to createProcess().

Process process = createProcess {
    command = "ls";
    arguments = ["-l"];
    path = home;
    output = OverwriteFileOutput {
        path = home.childPath("out.txt");
    };
    error = AppendFileOutput {
        path = home.childPath("err.txt");
    };
};

The objects currentInput, currentOutput, and currentError allow the standard input, output, and error streams to be redirected to the standard input, output, and error streams of the current virtual machine process.

Process process = createProcess {
    command = "ls";
    arguments = ["-l"];
    path = home;
    output = currentOutput;
    error = currentError;
};

To wait for the child process to terminate, call the waitForExit() method of Process.

Dependencies
ceylon.file/1.3.3 shared
ceylon.language/1.3.3
java.base/7 JDK
Usage
  • Import
 import ceylon.process "1.3.3";
Module links Members
Imported By
Home
Code repository
Issue tracker
Browse
Download .car
No .js archive
Download source archive
Download module documentation
View API documentation

Ceylon Herd v1.24 Copyright 2012-2023 Red Hat. About