mirror of
https://github.com/nim-lang/Nim.git
synced 2025-12-30 09:54:49 +00:00
* Add workingDir parameter to execProcess * Fix tests/stdlib/tosproc.nim compile error * Suppress output from tosproc.nim
25 lines
712 B
Nim
25 lines
712 B
Nim
discard """
|
|
file: "tospaths.nim"
|
|
output: ""
|
|
"""
|
|
# test the osproc module
|
|
|
|
import os, osproc
|
|
|
|
block execProcessTest:
|
|
let dir = parentDir(currentSourcePath())
|
|
let (outp, err) = execCmdEx("nim c " & quoteShell(dir / "osproctest.nim"))
|
|
doAssert err == 0
|
|
let exePath = dir / addFileExt("osproctest", ExeExt)
|
|
let outStr1 = execProcess(exePath, workingDir=dir, args=["foo", "b A r"], options={})
|
|
doAssert outStr1 == dir & "\nfoo\nb A r\n"
|
|
|
|
const testDir = "t e st"
|
|
createDir(testDir)
|
|
doAssert dirExists(testDir)
|
|
let outStr2 = execProcess(exePath, workingDir=testDir, args=["x yz"], options={})
|
|
doAssert outStr2 == absolutePath(testDir) & "\nx yz\n"
|
|
|
|
removeDir(testDir)
|
|
removeFile(exePath)
|