feat: add CentOS7 single executable build
This commit is contained in:
@@ -1,10 +1,12 @@
|
||||
'use strict';
|
||||
|
||||
const path = require('path');
|
||||
const { fork } = require('child_process');
|
||||
const { fork, spawn } = require('child_process');
|
||||
|
||||
function createCodexAppWorkerClient(options = {}) {
|
||||
const workerPath = options.workerPath || path.join(__dirname, 'codex-app-worker.js');
|
||||
const workerCommand = String(options.workerCommand || '').trim();
|
||||
const workerArgs = Array.isArray(options.workerArgs) ? options.workerArgs : [];
|
||||
const onNotification = typeof options.onNotification === 'function' ? options.onNotification : () => {};
|
||||
const onServerRequest = typeof options.onServerRequest === 'function' ? options.onServerRequest : null;
|
||||
const onExit = typeof options.onExit === 'function' ? options.onExit : () => {};
|
||||
@@ -40,11 +42,14 @@ function createCodexAppWorkerClient(options = {}) {
|
||||
workerExited = false;
|
||||
configured = false;
|
||||
appServerRunning = false;
|
||||
worker = fork(workerPath, [], {
|
||||
const spawnOptions = {
|
||||
cwd: options.cwd || process.cwd(),
|
||||
env: options.env || process.env,
|
||||
stdio: ['ignore', 'ignore', 'ignore', 'ipc'],
|
||||
});
|
||||
};
|
||||
worker = workerCommand
|
||||
? spawn(workerCommand, workerArgs, spawnOptions)
|
||||
: fork(workerPath, [], spawnOptions);
|
||||
|
||||
worker.on('message', (message = {}) => {
|
||||
if (Object.prototype.hasOwnProperty.call(message, 'id')) {
|
||||
|
||||
Reference in New Issue
Block a user