@geastack/cli 0.1.106 → 0.1.107

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@geastack/cli",
3
- "version": "0.1.106",
3
+ "version": "0.1.107",
4
4
  "description": "Command-line front door for GeaStack apps, targets, and local toolchains.",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -38,7 +38,7 @@
38
38
  "dependencies": {
39
39
  "@clack/prompts": "^1.8.0",
40
40
  "@geastack/simulator": "^0.1.15",
41
- "@geastack/targets": "^0.1.106",
41
+ "@geastack/targets": "^0.1.107",
42
42
  "picocolors": "^1.1.1",
43
43
  "serialport": "^13.0.0"
44
44
  },
@@ -83,16 +83,38 @@ function linkTarget(file) {
83
83
  }
84
84
  }
85
85
 
86
+ function traversable(link) {
87
+ try {
88
+ readdirSync(link)
89
+ return true
90
+ } catch {
91
+ return false
92
+ }
93
+ }
94
+
86
95
  // Makes buildDir a junction to binaryDir. An existing link to it is kept, so
87
96
  // the build is incremental. Anything else at buildDir -- a build from before
88
97
  // builds moved, or a link to another directory -- is replaced; its CMake
89
98
  // cache names a different binary directory, so it could not be reused. When
90
99
  // buildDir is missing (deleted to force a clean build), binaryDir starts
91
100
  // empty as well, so deleting the build directory still means a clean build.
101
+ //
102
+ // A link to the right directory that this process cannot follow is made again,
103
+ // keeping what it points at. Windows marks a junction made by a sandboxed or
104
+ // lower-integrity process as an untrusted mount point, and refuses to traverse
105
+ // it from any other (ERROR_UNTRUSTED_MOUNT_POINT, which Node reports as
106
+ // UNKNOWN): a build first run from such a shell left a link every later build
107
+ // failed on, at its first write through it.
92
108
  export function linkEsp32BinaryDir(buildDir, binaryDir, log = () => {}) {
93
109
  if (binaryDir === buildDir) return
94
110
  const current = linkTarget(buildDir)
95
- if (current !== null && windowsPathKey(current) === windowsPathKey(binaryDir) && existsSync(binaryDir)) return
111
+ if (current !== null && windowsPathKey(current) === windowsPathKey(binaryDir) && existsSync(binaryDir)) {
112
+ if (traversable(buildDir)) return
113
+ log(`Re-creating ${buildDir}: this process cannot follow the link there`)
114
+ unlinkSync(buildDir)
115
+ symlinkSync(binaryDir, buildDir, 'junction')
116
+ return
117
+ }
96
118
  if (current !== null) {
97
119
  unlinkSync(buildDir)
98
120
  } else if (existsSync(buildDir)) {