nim-dagger/tests/integration/nodes.nim

23 lines
622 B
Nim
Raw Normal View History

import std/osproc
import std/os
import std/streams
import std/strutils
const workingDir = currentSourcePath() / ".." / ".." / ".."
const executable = "build" / "dagger"
proc startNode*(args: openArray[string], debug = false): Process =
if debug:
result = startProcess(executable, workingDir, args, options={poParentStreams})
sleep(1000)
else:
result = startProcess(executable, workingDir, args)
for line in result.outputStream.lines:
if line.contains("Started dagger node"):
break
proc stop*(node: Process) =
node.terminate()
discard node.waitForExit(timeout=5_000)
node.close()