tosproc.nim 689 B

123456789101112131415161718192021222324
  1. discard """
  2. output: ""
  3. """
  4. # test the osproc module
  5. import os, osproc
  6. block execProcessTest:
  7. let dir = parentDir(currentSourcePath())
  8. let (outp, err) = execCmdEx("nim c " & quoteShell(dir / "osproctest.nim"))
  9. doAssert err == 0
  10. let exePath = dir / addFileExt("osproctest", ExeExt)
  11. let outStr1 = execProcess(exePath, workingDir=dir, args=["foo", "b A r"], options={})
  12. doAssert outStr1 == dir & "\nfoo\nb A r\n"
  13. const testDir = "t e st"
  14. createDir(testDir)
  15. doAssert dirExists(testDir)
  16. let outStr2 = execProcess(exePath, workingDir=testDir, args=["x yz"], options={})
  17. doAssert outStr2 == absolutePath(testDir) & "\nx yz\n"
  18. removeDir(testDir)
  19. removeFile(exePath)