Skip to content

Commit

Permalink
Rename Raises to Errant
Browse files Browse the repository at this point in the history
  • Loading branch information
propensive committed Apr 8, 2024
1 parent 9d1d7ee commit b2faf65
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions src/core/guillotine.scala
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ object Executor:
given string: Executor[String] = proc =>
Text.construct(stream.interpret(proc).map(_.s).each(append(_))).s

given dataStream(using streamCut: Raises[StreamError]): Executor[LazyList[Bytes]] =
given dataStream(using streamCut: Errant[StreamError]): Executor[LazyList[Bytes]] =
proc => Readable.inputStream.read(proc.getInputStream.nn)

given exitStatus: Executor[ExitStatus] = _.waitFor() match
Expand Down Expand Up @@ -87,7 +87,7 @@ trait ProcessRef:
object OsProcess:
private def allHandles = ProcessHandle.allProcesses.nn.iterator.nn.asScala.to(List)

def apply(pid: Pid)(using pidError: Raises[PidError]): OsProcess =
def apply(pid: Pid)(using pidError: Errant[PidError]): OsProcess =
val handle = ProcessHandle.of(pid.value).nn
if handle.isPresent then new OsProcess(handle.get.nn) else abort(PidError(pid))

Expand Down Expand Up @@ -122,7 +122,7 @@ object Process:

(process, stream) => process.stdin(stream)

given appendableText(using streamCut: Raises[StreamError]): Appendable[Process[?, ?], Text]^{streamCut} =
given appendableText(using streamCut: Errant[StreamError]): Appendable[Process[?, ?], Text]^{streamCut} =
(process, stream) => process.stdin(stream.map(_.sysBytes))

class Process[+ExecType <: Label, ResultType](process: java.lang.Process) extends ProcessRef:
Expand Down Expand Up @@ -151,7 +151,7 @@ class Process[+ExecType <: Label, ResultType](process: java.lang.Process) extend
//Log.warn(t"The process with PID ${pid.value} was killed")
process.destroyForcibly()

def osProcess(using Raises[PidError]) = OsProcess(pid)
def osProcess(using Errant[PidError]) = OsProcess(pid)

def startTime[InstantType: SpecificInstant]: Optional[InstantType] =
try
Expand All @@ -168,17 +168,17 @@ class Process[+ExecType <: Label, ResultType](process: java.lang.Process) extend
sealed trait Executable:
type Exec <: Label

def fork[ResultType]()(using working: WorkingDirectory, log: Log[Text], exec: Raises[ExecError])
def fork[ResultType]()(using working: WorkingDirectory, log: Log[Text], exec: Errant[ExecError])
: Process[Exec, ResultType]^{working}

def exec[ResultType]()
(using working: WorkingDirectory, log: Log[Text], executor: Executor[ResultType], exec: Raises[ExecError])
(using working: WorkingDirectory, log: Log[Text], executor: Executor[ResultType], exec: Errant[ExecError])
: ResultType^{executor, working} =

fork[ResultType]().await()

def apply[ResultType]()(using erased commandOutput: CommandOutput[Exec, ResultType])
(using working: WorkingDirectory, log: Log[Text], executor: Executor[ResultType], exec: Raises[ExecError])
(using working: WorkingDirectory, log: Log[Text], executor: Executor[ResultType], exec: Errant[ExecError])
: ResultType^{executor, working} =

fork[ResultType]().await()
Expand Down Expand Up @@ -215,7 +215,7 @@ object Command:
given Show[Command] = command => formattedArguments(command.arguments)

case class Command(arguments: Text*) extends Executable:
def fork[ResultType]()(using working: WorkingDirectory, log: Log[Text], exec: Raises[ExecError])
def fork[ResultType]()(using working: WorkingDirectory, log: Log[Text], exec: Errant[ExecError])
: Process[Exec, ResultType] =

val processBuilder = ProcessBuilder(arguments.ss*)
Expand All @@ -232,7 +232,7 @@ object Pipeline:
given Show[Pipeline] = _.commands.map(_.show).join(t" | ")

case class Pipeline(commands: Command*) extends Executable:
def fork[ResultType]()(using working: WorkingDirectory, log: Log[Text], exec: Raises[ExecError])
def fork[ResultType]()(using working: WorkingDirectory, log: Log[Text], exec: Errant[ExecError])
: Process[Exec, ResultType] =

val processBuilders = commands.map: command =>
Expand Down

0 comments on commit b2faf65

Please sign in to comment.