Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

[BUG] JAVA_OPTS is incorrectly evaluated

未关闭
#1,213 0 条评论 0 个 reaction 已指派 1 人 在 GitHub 查看

@kay-schecker 已经在做这个了。

开始于 2026年6月2日。

评估

这个 Issue 还没有评估数据。

描述

bug

🐛 Bug Report:

Describe the bug

The content of the environment variable JAVA_OPTS is evaluated. In case it contains a | character, then the next part of it is interpreted as a new command.

I'm in a corporate network that is secured by a proxy. My JAVA_OPTS environment variable defines the settings so that Java can use the proxy:

$ env | grep JAVA_OPTS
JAVA_OPTS=-Dhttp.proxyHost=localhost -Dhttp.proxyPort=9000 -Dhttps.proxyHost=localhost -Dhttps.proxyPort=9000 -Dhttp.nonProxyHosts=127.*|localhost|*.local
$

The http.nonProxyHosts contains the | character as described by Java. The normal Java applications accept this environment variable correctly.

Steps to Reproduce

Steps to reproduce the behavior:

  1. Go to en empty directory.
  2. Install the cli:
    npm install -g @openapitools/openapi-generator-cli
  3. Call the generator without a | in the JAVA_OPTS:
    JAVA_OPTS="-Dhttp.nonProxyHosts=localhost" openapi-generator-cli help
  4. Call the generator with a | in the JAVA_OPTS:
    JAVA_OPTS="-Dhttp.nonProxyHosts=127.*|localhost" openapi-generator-cli help
Actuall response

The command from point 4. returns the error message:

Error: 'localhost' is not recognized as an internal or external command,
operable program or batch file.

    at C:\Users\S230984\AppData\Local\nvm\v22.22.3\node_modules\@openapitools\openapi-generator-cli\main.js:2:51423
    at ChildProcess.exithandler (node:child_process:424:5)
    at ChildProcess.emit (node:events:519:28)
    at maybeClose (node:internal/child_process:1101:16)
    at ChildProcess._handle.onexit (node:internal/child_process:304:5)

Node.js v22.22.3
Expected behavior

The command from point 3. returns a correct help response. The command from point 4. should return the same response.

Screenshots

N/A

Operation System (please complete the following information):
  • OS: Windows with a git-bash
  • Version 11
Package System (please complete the following information):
  • Version: Node.js 22
Additional context

I expect that the problem is that the java command with paramaters is evaluated too much. There are somewhere quotes missing. During the evaluation, the | character is then interpreted by the shell as a command pipe end the next part is expected to be a command (which it isn't). Additional quotes inside my environment variable is not needed. The normal shell doesn't automatically evaluate the content as a pipe. The following command (without additional quotes) returns the correct output:

$ echo $JAVA_OPTS
-Dhttp.proxyHost=localhost -Dhttp.proxyPort=9000 -Dhttps.proxyHost=localhost -Dhttps.proxyPort=9000 -Dhttp.nonProxyHosts=127.*|localhost|*.local
$
主要语言
TypeScript
星标
2k
派生
208
平均合并
7 小时 12 分钟
30 天内合并 PR
6

环境准备

我们还没有检查这个项目的环境配置文件。先看它的 README,通用步骤见我们的新手贡献指南。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

OpenAPITools/openapi-generator-cli 的其他 Issue

查看 OpenAPITools/openapi-generator-cli 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。