summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorAndinus <andinus@nand.sh>2020-04-15 00:35:05 +0530
committerAndinus <andinus@nand.sh>2020-04-15 00:35:05 +0530
commitd3948a4c1b08d9b1c8fe827db84715517cfa7ed9 (patch)
treea3b493cd21731257dc1e0b052bc9476fa1bf79c7
parentc3051ad44e91eedc89d94be7e4ed433f1d50aee1 (diff)
downloadlynx-d3948a4c1b08d9b1c8fe827db84715517cfa7ed9.tar.gz
Add example for UnveilPath / UnveilPathStrict in readme v0.3.0
-rw-r--r--README.org26
1 files changed, 26 insertions, 0 deletions
diff --git a/README.org b/README.org
index a4ec5ab..86ade3a 100644
--- a/README.org
+++ b/README.org
@@ -64,6 +64,32 @@ func main() {
 	}
 }
 #+END_SRC
+** UnveilPath / UnveilPathStrict
+UnveilPath takes a path, permission & unveils it, it will return an error if
+unveil fails at any step. "no such file or directory" error is ignored, if you
+want to get that error too then use UnveilPathStrict.
+
+#+BEGIN_SRC go
+package main
+
+import "tildegit.org/andinus/lynx"
+
+func main() {
+	path := "/dev/null"
+	flags := "rw"
+
+	err = lynx.UnveilPath(path)
+	if err != nil {
+		log.Fatal(err)
+	}
+
+	// This will return an error if the path doesn't exist.
+	err = lynx.UnveilPathStrict(path)
+	if err != nil {
+		log.Fatal(err)
+	}
+}
+#+END_SRC
 ** UnveilBlock
 UnveilBlock is just a wrapper around unix.UnveilBlock, it does nothing extra.
 You should use unix.UnveilBlock.