Skip to content

Commit

Permalink
Rename ExitStatus to Exit
Browse files Browse the repository at this point in the history
  • Loading branch information
propensive committed Oct 6, 2024
1 parent 6bef317 commit a80eef1
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 24 deletions.
6 changes: 3 additions & 3 deletions src/core/guillotine.Computable.scala
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,9 @@ object Computable:
given (using streamCut: Tactic[StreamError]) => LazyList[Bytes] is Computable as dataStream =
proc => Readable.inputStream.stream(proc.getInputStream.nn)

given ExitStatus is Computable as exitStatus = _.waitFor() match
case 0 => ExitStatus.Ok
case other => ExitStatus.Fail(other)
given Exit is Computable as exitStatus = _.waitFor() match
case 0 => Exit.Ok
case other => Exit.Fail(other)

given Unit is Computable = exitStatus.map(_ => ())

Expand Down
28 changes: 14 additions & 14 deletions src/core/guillotine.PosixCommands.scala
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,14 @@ trait PosixCommands:
erased given ("batch" is Intelligible into Text) as batch = ###
erased given ("bc" is Intelligible into Text) as bc = ###
erased given ("cat" is Intelligible into LazyList[Text]) as cat = ###
erased given ("chgrp" is Intelligible into ExitStatus) as chgrp = ###
erased given ("chmod" is Intelligible into ExitStatus) as chmod = ###
erased given ("chown" is Intelligible into ExitStatus) as chown = ###
erased given ("chgrp" is Intelligible into Exit) as chgrp = ###
erased given ("chmod" is Intelligible into Exit) as chmod = ###
erased given ("chown" is Intelligible into Exit) as chown = ###
erased given ("cksum" is Intelligible into Text) as cksum = ###
erased given ("cmp" is Intelligible into Text) as cmp = ###
erased given ("comm" is Intelligible into Text) as comm = ###
erased given ("command" is Intelligible into Text) as command = ###
erased given ("cp" is Intelligible into ExitStatus) as cp = ###
erased given ("cp" is Intelligible into Exit) as cp = ###
erased given ("crontab" is Intelligible into Text) as crontab = ###
erased given ("csplit" is Intelligible into Text) as csplit = ###
erased given ("cut" is Intelligible into Text) as cut = ###
Expand All @@ -65,8 +65,8 @@ trait PosixCommands:
erased given ("iconv" is Intelligible into Text) as iconv = ###
erased given ("id" is Intelligible into Text) as id = ###
erased given ("join" is Intelligible into Text) as join = ###
erased given ("kill" is Intelligible into ExitStatus) as kill = ###
erased given ("ln" is Intelligible into ExitStatus) as ln = ###
erased given ("kill" is Intelligible into Exit) as kill = ###
erased given ("ln" is Intelligible into Exit) as ln = ###
erased given ("locale" is Intelligible into Text) as locale = ###
erased given ("localedef" is Intelligible into Text) as localedef = ###
erased given ("logger" is Intelligible into Text) as logger = ###
Expand All @@ -77,10 +77,10 @@ trait PosixCommands:
erased given ("mailx" is Intelligible into Text) as mailx = ###
erased given ("man" is Intelligible into LazyList[Text]) as man = ###
erased given ("mesg" is Intelligible into Text) as mesg = ###
erased given ("mkdir" is Intelligible into ExitStatus) as mkdir = ###
erased given ("mkfifo" is Intelligible into ExitStatus) as mkfifo = ###
erased given ("mv" is Intelligible into ExitStatus) as mv = ###
erased given ("newgrp" is Intelligible into ExitStatus) as newgrp = ###
erased given ("mkdir" is Intelligible into Exit) as mkdir = ###
erased given ("mkfifo" is Intelligible into Exit) as mkfifo = ###
erased given ("mv" is Intelligible into Exit) as mv = ###
erased given ("newgrp" is Intelligible into Exit) as newgrp = ###
erased given ("od" is Intelligible into Text) as od = ###
erased given ("paste" is Intelligible into Text) as paste = ###
erased given ("patch" is Intelligible into Text) as patch = ###
Expand All @@ -92,10 +92,10 @@ trait PosixCommands:
erased given ("pwd" is Intelligible into Text) as pwd = ###
erased given ("read" is Intelligible into Text) as read = ###
erased given ("renice" is Intelligible into Text) as renice = ###
erased given ("rm" is Intelligible into ExitStatus) as rm = ###
erased given ("rmdir" is Intelligible into ExitStatus) as rmdir = ###
erased given ("rm" is Intelligible into Exit) as rm = ###
erased given ("rmdir" is Intelligible into Exit) as rmdir = ###
erased given ("sed" is Intelligible into LazyList[Text]) as sed = ###
erased given ("sleep" is Intelligible into ExitStatus) as sleep = ###
erased given ("sleep" is Intelligible into Exit) as sleep = ###
erased given ("sort" is Intelligible into LazyList[Text]) as sort = ###
erased given ("split" is Intelligible into Text) as split = ###
erased given ("strings" is Intelligible into LazyList[Text]) as strings = ###
Expand All @@ -104,7 +104,7 @@ trait PosixCommands:
erased given ("tail" is Intelligible into LazyList[Text]) as tail = ###
erased given ("tee" is Intelligible into Text) as tee = ###
erased given ("test" is Intelligible into Text) as test = ###
erased given ("touch" is Intelligible into ExitStatus) as touch = ###
erased given ("touch" is Intelligible into Exit) as touch = ###
erased given ("tput" is Intelligible into Text) as tput = ###
erased given ("tr" is Intelligible into Text) as tr = ###
erased given ("tsort" is Intelligible into Text) as tsort = ###
Expand Down
6 changes: 3 additions & 3 deletions src/core/guillotine.Process.scala
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,9 @@ class Process[+ExecType <: Label, ResultType](process: java.lang.Process) extend

def await()(using computable: ResultType is Computable): ResultType = computable.compute(process)

def exitStatus(): ExitStatus = process.waitFor() match
case 0 => ExitStatus.Ok
case other => ExitStatus.Fail(other)
def exitStatus(): Exit = process.waitFor() match
case 0 => Exit.Ok
case other => Exit.Fail(other)

def abort(): Unit logs ExecEvent =
Log.info(ExecEvent.AbortProcess(pid))
Expand Down
8 changes: 4 additions & 4 deletions src/test/tests.scala
Original file line number Diff line number Diff line change
Expand Up @@ -229,12 +229,12 @@ object Tests extends Suite(t"Guillotine tests"):
.assert(_ <= 100L)

test(t"successful exit status"):
sh"echo hello".exec[ExitStatus]()
.assert(_ == ExitStatus.Ok)
sh"echo hello".exec[Exit]()
.assert(_ == Exit.Ok)

test(t"failed exit status"):
sh"false".exec[ExitStatus]()
.assert(_ == ExitStatus.Fail(1))
sh"false".exec[Exit]()
.assert(_ == Exit.Fail(1))

test(t"nested command"):
val cmd = sh"echo 'Hello world'"
Expand Down

0 comments on commit a80eef1

Please sign in to comment.