sentFromMyUname/native.ts
2024-12-28 10:16:54 -05:00

25 lines
649 B
TypeScript

import { exec } from "child_process";
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());
}
});
});
}