pinokiod 8.0.20 → 8.0.21

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.
@@ -1887,6 +1887,9 @@ class Api {
1887
1887
  }
1888
1888
  } else {
1889
1889
  let { cwd, script } = await this.resolveScript(request.path)
1890
+ if (!request.cwd && this.isPathInsideRoot(cwd, PluginSources.systemPluginRoot(this.kernel))) {
1891
+ request.cwd = this.kernel.path("bin")
1892
+ }
1890
1893
 
1891
1894
  if (!script) {
1892
1895
  this.ondata({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pinokiod",
3
- "version": "8.0.20",
3
+ "version": "8.0.21",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -237,6 +237,34 @@ test("resolveActionSteps links system plugin setup prompts to plugin detail", as
237
237
  assert.equal(steps[0].params.target, "_parent")
238
238
  })
239
239
 
240
+ test("process uses kernel bin as a bundled plugin's implicit cwd", async () => {
241
+ const root = await fs.mkdtemp(path.join(os.tmpdir(), "pinokio-plugin-cwd-"))
242
+ try {
243
+ const virtualSystemRoot = path.join(root, "app.asar", "node_modules", "pinokiod", "system")
244
+ const virtualPluginDir = path.join(virtualSystemRoot, "plugin", "demo")
245
+
246
+ const kernel = createKernel()
247
+ kernel.homedir = path.join(root, "pinokio")
248
+ kernel.path = (...parts) => path.join(kernel.homedir, ...parts)
249
+ kernel.shell = { init: async () => {} }
250
+ kernel.systemPath = (...parts) => path.join(virtualSystemRoot, ...parts)
251
+ const api = new Api(kernel)
252
+ const request = { uri: path.join(virtualPluginDir, "pinokio.js") }
253
+ api.logSessions = null
254
+ api.resolveScript = async () => ({
255
+ cwd: virtualPluginDir,
256
+ script: { run: [{ method: "shell.run", params: { message: "install" } }] },
257
+ })
258
+ api.queue = () => {}
259
+
260
+ await api.process(request, () => {})
261
+
262
+ assert.equal(request.cwd, kernel.path("bin"))
263
+ } finally {
264
+ await fs.rm(root, { recursive: true, force: true })
265
+ }
266
+ })
267
+
240
268
  test("resolveActionSteps runs plugin action directly when installed check passes", async () => {
241
269
  const api = new Api(createKernel())
242
270
  const request = { id: "plugin-run-installed", path: "/pinokio/plugin/demo/pinokio.js" }