Skip to content

Commit

Permalink
Slight reformatting
Browse files Browse the repository at this point in the history
Signed-off-by: Euan Torano <[email protected]>
  • Loading branch information
euantorano committed Jun 16, 2017
1 parent f083b59 commit b2fc2c3
Show file tree
Hide file tree
Showing 9 changed files with 1,411 additions and 62 deletions.
11 changes: 8 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
nimcache/
*.html
tests/main
nimcache
tests/*
!tests/*.nim
!tests/nim.cfg
src/*
!src/*.nim
nimsuggest.log
.vscode
6 changes: 1 addition & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@


# Copied from https://github.com/nim-lang/Nim/wiki/TravisCI
language: c
env:
Expand Down Expand Up @@ -39,9 +37,7 @@ install:
before_script:
- export PATH="nim-$BRANCH/bin${PATH:+:$PATH}"
script:
- nim c --cc:$CC --verbosity:0 -r pledge.nim
# Optional: build docs.
- nim doc2 --docSeeSrcUrl:https://github.com/euantorano/pledge.nim/blob/master --project pledge.nim
- nim c --cc:$CC --verbosity:0 -r tests/main.nim
cache:
directories:
- nim-master
Expand Down
18 changes: 12 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,24 +1,30 @@
# pledge.nim
# pledge.nim [![Travis CI Status](https://travis-ci.org/euantorano/pledge.nim.svg?branch=master)](https://travis-ci.org/euantorano/pledge.nim)

A wrapper around OpenBSD's pledge(2) systemcall for Nim.

## Installation

This package can be installed using `nimble`:
`pledge` can be installed using Nimble:

```
nimble install pledge
```

Or add the following to your `.nimble` file:

```
# Dependencies
requires "pledge >= 1.1.0"
```

## Usage

```nim
import pledge
if not pledge(Promises.Stdio):
# Pledge failed, cannot use stdio
quit(QuitFailure)
pledge(Promises.Stdio)
# As we haven't used pledge to ask to access files, the below will cause the program to be temrinated.
# As we haven't used pledge to ask to access files, the below will cause the program to be temrinated with a SIGABRT.
let f = open("/etc/rc.conf")
```
Loading

0 comments on commit b2fc2c3

Please sign in to comment.