sentFromMyUname/native.ts

25 lines
611 B
TypeScript
Raw Permalink Normal View History

2024-12-28 10:15:35 -05:00
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());
}
});
});
}