mirror of
https://github.com/harivansh-afk/deskctl.git
synced 2026-04-15 09:01:15 +00:00
parent
425a71095a
commit
714e34ba19
16 changed files with 849 additions and 66 deletions
36
npm/deskctl-cli/bin/deskctl.js
Normal file
36
npm/deskctl-cli/bin/deskctl.js
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
#!/usr/bin/env node
|
||||
|
||||
const fs = require("node:fs");
|
||||
const { spawn } = require("node:child_process");
|
||||
|
||||
const { readPackageJson, releaseTag, supportedTarget, vendorBinaryPath } = require("../scripts/support");
|
||||
|
||||
function main() {
|
||||
const pkg = readPackageJson();
|
||||
const target = supportedTarget();
|
||||
const binaryPath = vendorBinaryPath(target);
|
||||
|
||||
if (!fs.existsSync(binaryPath)) {
|
||||
console.error(
|
||||
[
|
||||
"deskctl binary is missing from the npm package install.",
|
||||
`Expected: ${binaryPath}`,
|
||||
`Package version: ${pkg.version}`,
|
||||
`Release tag: ${releaseTag(pkg)}`,
|
||||
"Try reinstalling deskctl-cli or check that your target is supported."
|
||||
].join("\n")
|
||||
);
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
const child = spawn(binaryPath, process.argv.slice(2), { stdio: "inherit" });
|
||||
child.on("exit", (code, signal) => {
|
||||
if (signal) {
|
||||
process.kill(process.pid, signal);
|
||||
return;
|
||||
}
|
||||
process.exit(code ?? 1);
|
||||
});
|
||||
}
|
||||
|
||||
main();
|
||||
Loading…
Add table
Add a link
Reference in a new issue