[BUG] JAVA_OPTS is incorrectly evaluated

Đang mở
#1,213 0 bình luận 0 reaction 1 người được giao Xem trên GitHub

@kay-schecker đang làm issue này rồi.

Từ ngày 2/6/2026.

Đánh giá

Issue này chưa được đánh giá.

Mô tả

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
$
Ngôn ngữ chính
TypeScript
Star
2k
Fork
208
Merge trung bình
7 giờ 12 phút
Pull request đã merge (30 ngày)
6

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của OpenAPITools/openapi-generator-cli

Tất cả issue của OpenAPITools/openapi-generator-cli

Issue tương tự

Thêm issue về TypeScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.