• 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
lucaswerkmeister / de.lucaswerkmeister.ceylond.daemonizeProgram
Description

This module allows you to turn a regular Ceylon program into a daemonized version. On each connection, the daemon will accept command line arguments, a working directory, and standard input. It will then set up the environment for the program, and launch it. Afterwards, the program’s output and result are sent over the connection again. A simple client that just communicates with the daemon can then be used in place of the original program, eliminating VM startup time and taking advantage of VM optimizations for long-running programs. One example client may be found in the client/ directory of the source code repository of this module; if you wish to implement your own client, please consult the detailed protocol description in the makeDaemonizeProgramInstance documentation.

import com.example.program { program=run }
import de.lucaswerkmeister.ceylond.daemonizeProgram { daemonizeProgram }

shared void run() => daemonizeProgram { program; fd = 3; };

The following mechanisms are trapped/replaced and may be used by the program:

  • standard input, output and error (but note that all standard input must be provided before the program starts)
  • process.exit
  • process.arguments, including named arguments
  • uncaught exceptions from the run function

The working directory of the daemon process remains unchanged, but a small handler may be [[registered|makeDaemonizeProgramInstance.argumentsMap]] to adapt paths in process.arguments as needed.

The following mechanisms are not trapped/replaced and should not be used by the program:

  • process.propertyValue
  • process.environmentVariableValue
  • any backend-specific mechanism

Logging

This module provides a custom version of the core module’s [[de.lucaswerkmeister.ceylond.core::writeSystemdLog]] that does not interfere with trapped standard error: see writeSystemdLog.

Last Published Jan 19, 2017
Stats Downloads (JVM): 238
Downloads (JS): 62
Source downloads: 300
Module links Imported By
Browse
List of published versions
1.0.0 JVM JavaScript JVM: 1.2.x, 1.3.x (latest) JavaScript: 1.2.1, 1.2.2, 1.3.x (latest) Published Jan 19, 2017 Browse
View docs
You must be logged in to comment.

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