aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/library/lux/world/shell.lux
diff options
context:
space:
mode:
authorEduardo Julian2021-08-09 23:02:01 -0400
committerEduardo Julian2021-08-09 23:02:01 -0400
commit464b6e8f5e6c62f58fa8c7ff61ab2ad215e98bd1 (patch)
tree1ae9d95956cee4251cd29a3e24c246c4360d567d /stdlib/source/library/lux/world/shell.lux
parentf621a133e6e0a516c0586270fea8eaffb4829d82 (diff)
Improved single-line comment syntax (from "##" to "...").
Diffstat (limited to 'stdlib/source/library/lux/world/shell.lux')
-rw-r--r--stdlib/source/library/lux/world/shell.lux66
1 files changed, 33 insertions, 33 deletions
diff --git a/stdlib/source/library/lux/world/shell.lux b/stdlib/source/library/lux/world/shell.lux
index b8fae1871..a09be98bb 100644
--- a/stdlib/source/library/lux/world/shell.lux
+++ b/stdlib/source/library/lux/world/shell.lux
@@ -91,7 +91,7 @@
[process (\ shell execute input)]
(in (..async_process process)))))))
-## https://en.wikipedia.org/wiki/Code_injection#Shell_injection
+... https://en.wikipedia.org/wiki/Code_injection#Shell_injection
(interface: (Policy ?)
(: (-> Command (Safe Command ?))
command)
@@ -106,32 +106,32 @@
(type: Replacer
(-> Text Text))
-(def: (replace bad replacer)
+(def: (replaced bad replacer)
(-> Text Replacer (-> Text Text))
- (text.replace_all bad (replacer bad)))
+ (text.replaced bad (replacer bad)))
(def: safe_common_command
(-> Replacer (Sanitizer Command))
(let [x0A (text.of_char (hex "0A"))
xFF (text.of_char (hex "FF"))]
(function (_ replacer)
- (|>> (..replace x0A replacer)
- (..replace xFF replacer)
- (..replace "\" replacer)
- (..replace "&" replacer)
- (..replace "#" replacer)
- (..replace ";" replacer)
- (..replace "`" replacer)
- (..replace "|" replacer)
- (..replace "*" replacer)
- (..replace "?" replacer)
- (..replace "~" replacer)
- (..replace "^" replacer)
- (..replace "$" replacer)
- (..replace "<" replacer) (..replace ">" replacer)
- (..replace "(" replacer) (..replace ")" replacer)
- (..replace "[" replacer) (..replace "]" replacer)
- (..replace "{" replacer) (..replace "}" replacer)))))
+ (|>> (..replaced x0A replacer)
+ (..replaced xFF replacer)
+ (..replaced "\" replacer)
+ (..replaced "&" replacer)
+ (..replaced "#" replacer)
+ (..replaced ";" replacer)
+ (..replaced "`" replacer)
+ (..replaced "|" replacer)
+ (..replaced "*" replacer)
+ (..replaced "?" replacer)
+ (..replaced "~" replacer)
+ (..replaced "^" replacer)
+ (..replaced "$" replacer)
+ (..replaced "<" replacer) (..replaced ">" replacer)
+ (..replaced "(" replacer) (..replaced ")" replacer)
+ (..replaced "[" replacer) (..replaced "]" replacer)
+ (..replaced "{" replacer) (..replaced "}" replacer)))))
(def: (policy safe_command safe_argument)
(Ex [?] (-> (Sanitizer Command) (Sanitizer Argument) (Policy ?)))
@@ -149,7 +149,7 @@
safe_command (: (Sanitizer Command)
(..safe_common_command replacer))
safe_argument (: (Sanitizer Argument)
- (|>> (..replace "'" replacer)
+ (|>> (..replaced "'" replacer)
(text.enclosed' "'")))]
(..policy safe_command safe_argument)))
@@ -158,12 +158,12 @@
(function.constant " "))
safe_command (: (Sanitizer Command)
(|>> (..safe_common_command replacer)
- (..replace "%" replacer)
- (..replace "!" replacer)))
+ (..replaced "%" replacer)
+ (..replaced "!" replacer)))
safe_argument (: (Sanitizer Argument)
- (|>> (..replace "%" replacer)
- (..replace "!" replacer)
- (..replace text.double_quote replacer)
+ (|>> (..replaced "%" replacer)
+ (..replaced "!" replacer)
+ (..replaced text.double_quote replacer)
(text.enclosed' text.double_quote)))]
(..policy safe_command safe_argument)))
@@ -279,7 +279,7 @@
["#::."
(#static getProperty [java/lang/String] #io #try java/lang/String)])
- ## https://en.wikipedia.org/wiki/Code_injection#Shell_injection
+ ... https://en.wikipedia.org/wiki/Code_injection#Shell_injection
(def: windows?
(IO (Try Bit))
(\ (try.with io.monad) map
@@ -324,11 +324,11 @@
(~~ (template [<name> <mock>]
[(def: (<name> _)
(do {! io.monad}
- [|state| (atom.read state)]
+ [|state| (atom.read! state)]
(case (\ mock <mock> |state|)
(#try.Success [|state| output])
(do !
- [_ (atom.write |state| state)]
+ [_ (atom.write! |state| state)]
(in (#try.Success output)))
(#try.Failure error)
@@ -340,22 +340,22 @@
))
(def: (write message)
(do {! io.monad}
- [|state| (atom.read state)]
+ [|state| (atom.read! state)]
(case (\ mock on_write message |state|)
(#try.Success |state|)
(do !
- [_ (atom.write |state| state)]
+ [_ (atom.write! |state| state)]
(in (#try.Success [])))
(#try.Failure error)
(in (#try.Failure error)))))
(def: (destroy _)
(do {! io.monad}
- [|state| (atom.read state)]
+ [|state| (atom.read! state)]
(case (\ mock on_destroy |state|)
(#try.Success |state|)
(do !
- [_ (atom.write |state| state)]
+ [_ (atom.write! |state| state)]
(in (#try.Success [])))
(#try.Failure error)