@lace-cloud/host 0.27.0 → 0.29.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/dist/index.d.mts CHANGED
@@ -49,8 +49,10 @@ type ServerState = 'stopped' | 'starting' | 'running' | 'error';
49
49
 
50
50
  /**
51
51
  * The engine binary could not be started, so no engine ran. `cause` is the
52
- * spawn error itself and `code` its system code — `ENOENT` when no executable
53
- * is found at the path or on PATH. A host branches on `code`, never on
52
+ * spawn error itself, whether the platform refused the spawn at once (thrown:
53
+ * Windows refuses a `.cmd` or `.bat` with `EINVAL`) or the process failed to
54
+ * start (emitted: `ENOENT` when no executable is found at the path or on
55
+ * PATH), and `code` is its code. A host branches on `code`, never on
54
56
  * `message`.
55
57
  */
56
58
  declare class EngineSpawnError extends Error {
@@ -1923,7 +1925,8 @@ declare class ServerManager extends EventEmitter {
1923
1925
  * of `Initialize`'s answer): an engine that names another rejects with
1924
1926
  * `EngineProtocolMismatchError`. A binary that cannot be started rejects
1925
1927
  * with `EngineSpawnError`, whose `code` is the spawn error's (`ENOENT`
1926
- * when no executable is found).
1928
+ * when no executable is found, `EINVAL` when Windows refuses to start a
1929
+ * `.cmd` or `.bat`).
1927
1930
  * An engine a failed start spawned is ended before the rejection.
1928
1931
  */
1929
1932
  start(): Promise<void>;
package/dist/index.d.ts CHANGED
@@ -49,8 +49,10 @@ type ServerState = 'stopped' | 'starting' | 'running' | 'error';
49
49
 
50
50
  /**
51
51
  * The engine binary could not be started, so no engine ran. `cause` is the
52
- * spawn error itself and `code` its system code — `ENOENT` when no executable
53
- * is found at the path or on PATH. A host branches on `code`, never on
52
+ * spawn error itself, whether the platform refused the spawn at once (thrown:
53
+ * Windows refuses a `.cmd` or `.bat` with `EINVAL`) or the process failed to
54
+ * start (emitted: `ENOENT` when no executable is found at the path or on
55
+ * PATH), and `code` is its code. A host branches on `code`, never on
54
56
  * `message`.
55
57
  */
56
58
  declare class EngineSpawnError extends Error {
@@ -1923,7 +1925,8 @@ declare class ServerManager extends EventEmitter {
1923
1925
  * of `Initialize`'s answer): an engine that names another rejects with
1924
1926
  * `EngineProtocolMismatchError`. A binary that cannot be started rejects
1925
1927
  * with `EngineSpawnError`, whose `code` is the spawn error's (`ENOENT`
1926
- * when no executable is found).
1928
+ * when no executable is found, `EINVAL` when Windows refuses to start a
1929
+ * `.cmd` or `.bat`).
1927
1930
  * An engine a failed start spawned is ended before the rejection.
1928
1931
  */
1929
1932
  start(): Promise<void>;
package/dist/index.mjs CHANGED
@@ -10782,9 +10782,15 @@ var EngineSpawnError = class extends Error {
10782
10782
  function spawnEngine(binaryPath, log) {
10783
10783
  return new Promise((resolve, reject) => {
10784
10784
  log(`Spawning: ${binaryPath} engine`);
10785
- const proc = spawn(binaryPath, ["engine"], {
10786
- stdio: ["pipe", "pipe", "pipe"]
10787
- });
10785
+ let proc;
10786
+ try {
10787
+ proc = spawn(binaryPath, ["engine"], {
10788
+ stdio: ["pipe", "pipe", "pipe"]
10789
+ });
10790
+ } catch (err) {
10791
+ reject(new EngineSpawnError(err instanceof Error ? err : new Error(String(err))));
10792
+ return;
10793
+ }
10788
10794
  proc.stdin?.on("error", (err) => {
10789
10795
  log(`[stdin] ${err.message}`);
10790
10796
  });
@@ -11023,7 +11029,8 @@ var ServerManager = class extends EventEmitter {
11023
11029
  * of `Initialize`'s answer): an engine that names another rejects with
11024
11030
  * `EngineProtocolMismatchError`. A binary that cannot be started rejects
11025
11031
  * with `EngineSpawnError`, whose `code` is the spawn error's (`ENOENT`
11026
- * when no executable is found).
11032
+ * when no executable is found, `EINVAL` when Windows refuses to start a
11033
+ * `.cmd` or `.bat`).
11027
11034
  * An engine a failed start spawned is ended before the rejection.
11028
11035
  */
11029
11036
  async start() {