/*---------------------------------------------------------------------------
  Copyright 2020-2021, Microsoft Research, Daan Leijen.

  This is free software; you can redistribute it and/or modify it under the
  terms of the Apache License, Version 2.0. A copy of the License can be
  found in the LICENSE file at the root of this distribution.
---------------------------------------------------------------------------*/

/* Run processes.
*/
module std/os/processstd/os/process

import std/os/pathstd/os/path

extern import {
  c file "process-inline.c"
}

// Run a command in the shell and return its output as a string.
pub extern run-system-readstd/os/process/run-system-read: (cmd : string) -> io error<string>( cmdcmd: string : stringstd/core/types/string: V ) : iostd/core/io: E errorstd/core/exn/error: V -> V<stringstd/core/types/string: V> {
  c "kk_os_run_command_error"
}result: -> io error<string>

// Run a command in the shell
pub extern run-systemstd/os/process/run-system: (cmd : string) -> io int( cmdcmd: string : stringstd/core/types/string: V ) : iostd/core/io: E intstd/core/types/int: V {
  c "kk_os_run_system_prim"
}result: -> io int