{"record":{"id":"c396f8f9696a4dfe","repo":"docmirror/dev-sidecar","slug":"error-c396f8","errorCode":null,"errorMessage":"暂未实现此功能","messagePattern":"暂未实现此功能","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"packages/core/src/shell/scripts/set-system-env.js","lineNumber":79,"sourceCode":"      try {\n        for (const item of list) {\n          if (item.value == null) {\n            delete process.env[item.key]\n          } else {\n            process.env[item.key] = String(item.value)\n          }\n        }\n      } catch (e) {\n        envUpdateError = e.message || String(e)\n      }\n\n      return { success: true, scope: appliedScope, output: ret, envUpdateError }\n    } catch (finalErr) {\n      return { success: false, error: finalErr.message || String(finalErr), details: finalErr.stack }\n    }\n  },\n  async linux (exec, { port }) {\n    throw new Error('暂未实现此功能')\n  },\n  async mac (exec, { port }) {\n    throw new Error('暂未实现此功能')\n  },\n}\n\nmodule.exports = async function (args) {\n  return execute(executor, args)\n}\n","sourceCodeStart":61,"sourceCodeEnd":89,"githubUrl":"https://github.com/docmirror/dev-sidecar/blob/7710cd56cce760c708f30b01d2d4056eb8c402d5/packages/core/src/shell/scripts/set-system-env.js#L61-L89","documentation":"set-system-env writes persistent environment variables (PowerShell [Environment]::SetEnvironmentVariable, with setx fallbacks) — Windows only. The linux executor is a stub that always throws this 'not yet implemented' error; your arguments are irrelevant to the outcome.","triggerScenarios":"Calling the set-system-env shell script with platform=linux — attempting to persist system/user environment variables through DevSidecar on Linux.","commonSituations":"Trying to have dev-sidecar set HTTP_PROXY/HTTPS_PROXY or similar as persistent env vars on a Linux desktop/server; provisioning scripts reusing the Windows-oriented API.","solutions":["Persist variables yourself: add `export KEY=value` to ~/.bashrc / ~/.profile (user) or /etc/environment (system-wide).","For systemd user services, use `systemctl --user set-environment` or drop-ins with Environment=.","Patch the linux executor in packages/core/src/shell/scripts/set-system-env.js to append to the appropriate shell profile.","Set the vars per-invocation instead of persisting them (prefix the command with KEY=value)."],"exampleFix":null,"handlingStrategy":"fallback","validationCode":"const os = require('os')\nif (os.platform() !== 'win32') {\n  const fs = require('fs')\n  fs.appendFileSync(`${os.homedir()}/.bashrc`, `export HTTP_PROXY=http://127.0.0.1:${port}\\nexport HTTPS_PROXY=http://127.0.0.1:${port}\\n`)\n}","typeGuard":"null","tryCatchPattern":"try {\n  await setSystemEnv({ list })\n} catch (e) {\n  if (e.message === '暂未实现此功能' && process.platform === 'linux') {\n    // write to /etc/environment or ~/.profile yourself\n    require('fs').appendFileSync('/etc/environment', `KEY=value\\n`)\n  } else throw e\n}","preventionTips":["Feature-gate persistent env-var writes on platform === 'win32'.","On Linux prefer ~/.profile, ~/.bashrc or /etc/environment managed by your own tooling.","For transient needs, prefix commands with the vars instead of persisting them.","Check feature support per platform before invoking shell scripts from this library."],"tags":["linux","environment-variables","not-implemented","system-config"],"backgroundTag":"feature-not-implemented-on-platform","analyzedSha":"7710cd56cce760c708f30b01d2d4056eb8c402d5","analyzedAt":"2026-08-31T22:07:07.234Z","schemaVersion":2},"datasetVersion":"2026-08-31T22:30:34.772Z"}