2024-07-30 23:24:17 +08:00
|
|
|
// declare global {
|
|
|
|
// function syscall(name: string, ...args: any[]): Promise<any>;
|
|
|
|
// }
|
2022-03-14 17:07:38 +08:00
|
|
|
|
2022-07-04 15:34:11 +08:00
|
|
|
// This is the case when running tests only, so giving it a dummy syscall function
|
|
|
|
if (typeof self === "undefined") {
|
2024-07-30 23:24:17 +08:00
|
|
|
(self as any) = {
|
2022-10-10 20:50:21 +08:00
|
|
|
syscall: () => {
|
2022-07-04 15:34:11 +08:00
|
|
|
throw new Error("Not implemented here");
|
|
|
|
},
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2024-08-07 17:09:56 +08:00
|
|
|
// Late binding syscall
|
2024-08-07 19:27:25 +08:00
|
|
|
export function syscall(name: string, ...args: any[]): Promise<any> {
|
2024-08-07 17:09:56 +08:00
|
|
|
return (globalThis as any).syscall(name, ...args);
|
|
|
|
}
|