import c run(path string) -> error { startInfo := new(StartupInfo) { size: 104, } processInfo := new(ProcessInformation) cpath := c.string(path) success := kernel32.CreateProcessA(0, cpath.ptr, 0, 0, false, 0, 0, 0, startInfo, processInfo) delete(cpath) if !success { return -1 } kernel32.WaitForSingleObject(processInfo.process, 0xFFFFFFFF) kernel32.CloseHandle(processInfo.process) kernel32.CloseHandle(processInfo.thread) return 0 } extern { kernel32 { CloseHandle(handle *any) -> bool CreateProcessA(applicationName *byte|nil, commandLine *byte, processAttributes *any|nil, threadAttributes *any|nil, inheritHandles bool, creationFlags uint32, environment *uint16|nil, currentDirectory *uint16|nil, startupInfo *any, processInformation *any) -> (success bool) WaitForSingleObject(handle *any, milliseconds uint32) -> uint32 } }