25 lines
611 B
TypeScript
25 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());
|
||
|
}
|
||
|
});
|
||
|
});
|
||
|
}
|