Swiftpack.co - Package - bluk/process-signals

📡 Process Signals

Apache-2.0 License Swift SPM Compatible Platforms

Build Status

Observes process signals using Grand Central Dispatch DispatchSourceSignal.

Getting Started

This package is intended for use with Swift Package Manager. To use in your own package, add the following dependency:

dependencies: [
    .package(url: "https://github.com/bluk/process-signals.git", from: "0.2.0")
]

Documentation

Docker

A simple example application is given in the Sources/Example directory.

You can run this application by cloning this repository and then running the following via Docker:

docker build . -t signals-example
docker run -it --rm --name=signals signals-example

The process name and process identifier is output like:

Process: Example (1)
Hello world!

You can send a signal to the process:

docker exec signals kill -s SIGUSR1 1

Replace 1 with the process identifier (should be 1 unless you change the Dockerfile's ENTRYPOINT or CMD).

To stop the container, you can run:

docker stop signals

You can try modifying the Dockerfile's ENTRYPOINT and CMD to be various values like:

ENTRYPOINT /Example

or

CMD ["./Example"]

or

CMD ./Example

To see what the behavior is (note the process identifier may change).

Development

If you wish to modify this code, you can clone this repository and use Swift Package Manager to build and test this code.

swift build
swift test

If you want to generate an Xcode project, you can run:

swift package generate-xcodeproj

Generate Docs

To generate the documentation, you need Ruby installed, and then run:

bundle install
swift package generate-xcodeproj
jazzy -o docs --module "ProcessSignals" --module-version <version> -g https://github.com/bluk/process-signals

Related Links

License

Apache-2.0 License

Github

link
Stars: 0
Help us keep the lights on

Dependencies

Used By

Total: 0

Releases

v0.2.0 - Sep 9, 2018

v0.1.0 - Aug 22, 2018