Retoor software development Projects Research SearchXNG
Register Sign In

9 lines
350 B
JavaScript
Raw Normal View History

feat: implement Process.cwd foreign method using libuv uv_cwd Add a new `Process.cwd` static method that retrieves the current working directory via libuv's `uv_cwd` function. The implementation includes proper error handling that aborts the fiber with a descriptive message on failure. The foreign method is registered in the module table and exposed in the Wren API with a foreign static declaration. A test suite validates that the returned value is a non-empty string starting with "/", resolves correctly via `File.realPath`, and corresponds to an existing directory.
2020-06-14 06:12:34 +02:00
import "io" for File, Directory
import "os" for Process
System.print(Process.cwd is String) // expect: true
System.print(!Process.cwd.isEmpty) // expect: true
System.print(Process.cwd.startsWith("/")) // expect: true
System.print(File.realPath(Process.cwd) == Process.cwd) // expect: true
System.print(Directory.exists(Process.cwd)) // expect: true
Reference in New Issue Copy Permalink
eadfc8e9cb
wren/test/os/process/cwd.wren
Response time: 32ms
Mail Licenses API