docmirror/dev-sidecar · warning

暂未实现此功能

Error message

暂未实现此功能

What it means

`get-system-env` reads OS environment/registry-like settings; only the Windows implementation exists. On Linux the handler throws `暂未实现此功能` as an explicit not-implemented marker.

Source

Thrown at packages/core/src/shell/scripts/get-system-env.js:24

const execute = Shell.execute

const executor = {
  async windows (exec) {
    const ret = await exec(['set'], { type: 'cmd' })
    const map = {}
    if (ret != null) {
      const lines = ret.split('\r\n')
      for (const item of lines) {
        const kv = item.split('=')
        if (kv.length > 1) {
          map[kv[0].trim()] = kv[1].trim()
        }
      }
    }
    return map
  },
  async linux (exec, { port }) {
    throw new Error('暂未实现此功能')
  },
  async mac (exec, { port }) {
    throw new Error('暂未实现此功能')
  },
}

module.exports = async function (args) {
  return execute(executor, args)
}

View on GitHub (pinned to 7710cd56cc)

Solutions

  1. Read environment values directly from `process.env` or shell (`printenv`, `env`) on Linux.
  2. Implement the linux handler to return a map built from `process.env`.
  3. Only call this helper on Windows; branch by platform.

Example fix

// before
const map = await DevSidecar.shell.getSystemEnv({ port })
// after
const map = process.platform === 'win32'
  ? await DevSidecar.shell.getSystemEnv({ port })
  : process.env
Defensive patterns

Strategy: fallback

Validate before calling

if (process.platform === 'win32') {
  const map = await DevSidecar.shell.getSystemEnv({ port })
} else {
  const map = process.env
}

Type guard

function supportsSystemEnvHelper () {
  return process.platform === 'win32'
}

Try / catch

try {
  map = await DevSidecar.shell.getSystemEnv({ port })
} catch (err) {
  if (err.message === '暂未实现此功能') {
    map = process.env
  } else { throw err }
}

Prevention

When it happens

Trigger: Calling the get-system-env shell API on Linux so execution dispatches to the placeholder `linux` handler in packages/core/src/shell/scripts/get-system-env.js:24.

Common situations: Settings/system pages of the GUI run on Linux; cross-platform scripts collecting system environment through this helper.

Related errors


AI-assisted analysis of docmirror/dev-sidecar@7710cd56cc (2026-08-31). Data as JSON: /api/errors/ed653297a1a34900. Report an issue: GitHub.