tworkingdir.nim 572 B

12345678910111213141516171819202122
  1. discard """
  2. output: ""
  3. """
  4. import osproc, os
  5. when defined(windows):
  6. # Windows don't have this issue, so we won't test it.
  7. discard
  8. else:
  9. let dir1 = getCurrentDir()
  10. var process: Process
  11. when defined(android):
  12. process = startProcess("/system/bin/env", "/system/bin", ["true"])
  13. elif defined(haiku):
  14. process = startProcess("/bin/env", "/bin", ["true"])
  15. else:
  16. process = startProcess("/usr/bin/env", "/usr/bin", ["true"])
  17. let dir2 = getCurrentDir()
  18. discard process.waitForExit()
  19. process.close()
  20. doAssert(dir1 == dir2, $dir1 & " != " & $dir2)