File tree 2 files changed +14
-2
lines changed
2 files changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -12,6 +12,7 @@ import Libraries.Text.PrettyPrint.Prettyprinter
12
12
import Libraries.Text.PrettyPrint.Prettyprinter.Util
13
13
import Libraries.Text.PrettyPrint.Prettyprinter.Doc
14
14
import Libraries.Data.Tap
15
+ import Libraries.System
15
16
16
17
import public Data . IORef
17
18
import System
@@ -989,7 +990,7 @@ handleExitCode cmd (ExitFailure status) = throw $ NonZeroExitCode cmd status
989
990
990
991
export
991
992
system : String -> Core ExitCode
992
- system = map cast . coreLift . system
993
+ system = map ( cast @{ ToExitCode }) . coreLift . system
993
994
994
995
||| Execute a shell command. Throws `NonZeroExitCode` if the command returns
995
996
||| non-zero exit code.
@@ -1000,7 +1001,7 @@ safeSystem cmd = system cmd >>= handleExitCode cmd
1000
1001
namespace Escaped
1001
1002
export
1002
1003
system : List String -> Core ExitCode
1003
- system = map cast . coreLift . system
1004
+ system = map ( cast @{ ToExitCode }) . coreLift . system
1004
1005
1005
1006
export
1006
1007
safeSystem : List String -> Core ()
Original file line number Diff line number Diff line change
1
+ module Libraries.System
2
+
3
+ import System
4
+
5
+ -- TODO: Remove this, once `Cast` from `base` is available to the compiler
6
+
7
+ export
8
+ [ToExitCode ] Cast Int ExitCode where
9
+ cast code with (code == 0 ) proof prf
10
+ _ | True = ExitSuccess
11
+ _ | False = ExitFailure code @{rewrite prf in Oh }
You can’t perform that action at this time.
0 commit comments