@lace-cloud/host 0.27.0 → 0.28.0

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.
package/README.md CHANGED
@@ -41,8 +41,8 @@ server.on('state', (state) => console.log(`engine: ${state}`));
41
41
  // which carries the engine's version and both protocol versions;
42
42
  // `engineTooOld` says which side is behind. A binary that cannot be started
43
43
  // rejects with EngineSpawnError: `cause` is the spawn error and `code` its
44
- // system code (`ENOENT` when no executable is found). What to show is the
45
- // host's.
44
+ // system code (`ENOENT` when no executable is found, `EINVAL` when Windows
45
+ // refuses to start a `.cmd` or `.bat`). What to show is the host's.
46
46
  try {
47
47
  await server.start();
48
48
  } catch (err) {
package/dist/index.cjs CHANGED
@@ -10829,9 +10829,15 @@ var EngineSpawnError = class extends Error {
10829
10829
  function spawnEngine(binaryPath, log) {
10830
10830
  return new Promise((resolve, reject) => {
10831
10831
  log(`Spawning: ${binaryPath} engine`);
10832
- const proc = (0, import_node_child_process.spawn)(binaryPath, ["engine"], {
10833
- stdio: ["pipe", "pipe", "pipe"]
10834
- });
10832
+ let proc;
10833
+ try {
10834
+ proc = (0, import_node_child_process.spawn)(binaryPath, ["engine"], {
10835
+ stdio: ["pipe", "pipe", "pipe"]
10836
+ });
10837
+ } catch (err) {
10838
+ reject(new EngineSpawnError(err instanceof Error ? err : new Error(String(err))));
10839
+ return;
10840
+ }
10835
10841
  proc.stdin?.on("error", (err) => {
10836
10842
  log(`[stdin] ${err.message}`);
10837
10843
  });
@@ -11070,7 +11076,8 @@ var ServerManager = class extends import_node_events.EventEmitter {
11070
11076
  * of `Initialize`'s answer): an engine that names another rejects with
11071
11077
  * `EngineProtocolMismatchError`. A binary that cannot be started rejects
11072
11078
  * with `EngineSpawnError`, whose `code` is the spawn error's (`ENOENT`
11073
- * when no executable is found).
11079
+ * when no executable is found, `EINVAL` when Windows refuses to start a
11080
+ * `.cmd` or `.bat`).
11074
11081
  * An engine a failed start spawned is ended before the rejection.
11075
11082
  */
11076
11083
  async start() {