@dench.com/cli 0.4.4 → 0.4.5

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.
Files changed (2) hide show
  1. package/home-sync.ts +14 -2
  2. package/package.json +1 -1
package/home-sync.ts CHANGED
@@ -9,9 +9,11 @@
9
9
  * symlink/rename limitations while keeping future sandboxes restorable.
10
10
  */
11
11
  import { spawn } from "node:child_process";
12
- import { cp, mkdtemp, rm, writeFile } from "node:fs/promises";
12
+ import { createReadStream, createWriteStream } from "node:fs";
13
+ import { mkdtemp, rm, writeFile } from "node:fs/promises";
13
14
  import { tmpdir } from "node:os";
14
15
  import { join } from "node:path";
16
+ import { pipeline } from "node:stream/promises";
15
17
  import {
16
18
  buildSnapshotName,
17
19
  buildTarCreateArgs,
@@ -61,6 +63,16 @@ function runCommand(command: string, args: string[]): Promise<void> {
61
63
  });
62
64
  }
63
65
 
66
+ async function copyBytesOnly(
67
+ source: string,
68
+ destination: string,
69
+ ): Promise<void> {
70
+ await pipeline(
71
+ createReadStream(source),
72
+ createWriteStream(destination, { flags: "wx" }),
73
+ );
74
+ }
75
+
64
76
  async function writeStatus(
65
77
  path: string,
66
78
  status: HomeSyncStatus,
@@ -178,7 +190,7 @@ class HomeSyncDaemon {
178
190
  "tar",
179
191
  buildTarCreateArgs({ liveHome: this.args.liveHome, archivePath }),
180
192
  );
181
- await cp(archivePath, durablePath, { force: false });
193
+ await copyBytesOnly(archivePath, durablePath);
182
194
  await pruneHomeSnapshots({
183
195
  snapshotDir: this.args.snapshotDir,
184
196
  keepSnapshots: this.args.keepSnapshots,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dench.com/cli",
3
- "version": "0.4.4",
3
+ "version": "0.4.5",
4
4
  "description": "Dench agent workspace CLI.",
5
5
  "type": "module",
6
6
  "bin": {