@rytuz/machine-access 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -8,11 +8,11 @@ const { spawnSync } = require("child_process");
|
|
|
8
8
|
|
|
9
9
|
const RUNTIME_RELEASE = Object.freeze({
|
|
10
10
|
schemaVersion: "1.0",
|
|
11
|
-
version: "0.1.
|
|
11
|
+
version: "0.1.1-standard.1",
|
|
12
12
|
platform: "win32",
|
|
13
13
|
arch: "x64",
|
|
14
|
-
sha256: "
|
|
15
|
-
size:
|
|
14
|
+
sha256: "6399631fad86d23162b4e0c7a5a9354a1bb1a960b4de668c75a55cb9229e27f1",
|
|
15
|
+
size: 11140249,
|
|
16
16
|
relativePath: path.join(
|
|
17
17
|
"..",
|
|
18
18
|
"payload",
|
|
@@ -195,7 +195,20 @@ function expandVerifiedPayload(zipPath, release, root, env = process.env) {
|
|
|
195
195
|
return target;
|
|
196
196
|
}
|
|
197
197
|
|
|
198
|
-
|
|
198
|
+
const PUBLIC_COMMANDS = Object.freeze([
|
|
199
|
+
"connect",
|
|
200
|
+
"start",
|
|
201
|
+
"stop",
|
|
202
|
+
"status",
|
|
203
|
+
"reconnect",
|
|
204
|
+
"enable-autostart",
|
|
205
|
+
"disable-autostart"
|
|
206
|
+
]);
|
|
207
|
+
|
|
208
|
+
function runAgentCommand(runtime, command, env = process.env) {
|
|
209
|
+
if (!PUBLIC_COMMANDS.includes(command)) {
|
|
210
|
+
fail("unsupported Rytuz Standard command");
|
|
211
|
+
}
|
|
199
212
|
const python = path.join(runtime, "python.exe");
|
|
200
213
|
const childEnv = { ...env };
|
|
201
214
|
delete childEnv.PYTHONPATH;
|
|
@@ -204,23 +217,31 @@ function runConnect(runtime, root, env = process.env) {
|
|
|
204
217
|
childEnv.PYTHONSAFEPATH = "1";
|
|
205
218
|
const child = spawnSync(
|
|
206
219
|
python,
|
|
207
|
-
["-B", "-S", "-m", "oryx_access.standard_agent",
|
|
220
|
+
["-B", "-S", "-m", "oryx_access.standard_agent", command],
|
|
208
221
|
{
|
|
209
222
|
cwd: runtime,
|
|
210
223
|
env: childEnv,
|
|
211
224
|
stdio: "inherit",
|
|
212
|
-
windowsHide:
|
|
225
|
+
windowsHide: command !== "connect"
|
|
213
226
|
}
|
|
214
227
|
);
|
|
215
228
|
if (child.error) throw child.error;
|
|
216
229
|
if (child.status !== 0) {
|
|
217
|
-
fail(
|
|
230
|
+
fail(
|
|
231
|
+
"Rytuz Standard " + command + " exited with code " + child.status
|
|
232
|
+
);
|
|
218
233
|
}
|
|
219
234
|
}
|
|
220
235
|
|
|
221
236
|
async function main(argv = process.argv.slice(2)) {
|
|
222
|
-
if (
|
|
223
|
-
|
|
237
|
+
if (
|
|
238
|
+
argv.length !== 1 ||
|
|
239
|
+
!PUBLIC_COMMANDS.includes(argv[0])
|
|
240
|
+
) {
|
|
241
|
+
console.error(
|
|
242
|
+
"Usage: npx @rytuz/machine-access@latest " +
|
|
243
|
+
"<connect|start|stop|status|reconnect|enable-autostart|disable-autostart>"
|
|
244
|
+
);
|
|
224
245
|
return 2;
|
|
225
246
|
}
|
|
226
247
|
if (process.platform !== "win32" || process.arch !== "x64") {
|
|
@@ -233,7 +254,7 @@ async function main(argv = process.argv.slice(2)) {
|
|
|
233
254
|
|
|
234
255
|
const payload = verifyPayload(bundledPayloadPath(), release);
|
|
235
256
|
const runtime = expandVerifiedPayload(payload, release, root);
|
|
236
|
-
|
|
257
|
+
runAgentCommand(runtime, argv[0]);
|
|
237
258
|
return 0;
|
|
238
259
|
}
|
|
239
260
|
|
|
@@ -254,6 +275,7 @@ if (require.main === module) {
|
|
|
254
275
|
|
|
255
276
|
module.exports = {
|
|
256
277
|
RUNTIME_RELEASE,
|
|
278
|
+
PUBLIC_COMMANDS,
|
|
257
279
|
stateRoot,
|
|
258
280
|
validateRelease,
|
|
259
281
|
sha256File,
|
package/package.json
CHANGED
|
Binary file
|