sentFromMyUname/native.ts
2024-12-29 09:20:03 -05:00

24 lines
611 B
TypeScript

const { spawn } = require("child_process");
export async function getUname(): Promise<string> {
return new Promise((resolve, reject) => {
const proc = spawn("uname", ["-a"]);
let output = "";
proc.stdout.on("data", (data) => {
output += data.toString();
});
proc.stderr.on("data", (data) => {
reject(data.toString());
});
proc.on("close", (code) => {
if (code !== 0) {
reject("it didnt work lol");
} else {
resolve(output.trim());
}
});
});
}