Title: Node CLI eval option can't take unary negation operator · Issue #43397 · nodejs/node · GitHub
Open Graph Title: Node CLI eval option can't take unary negation operator · Issue #43397 · nodejs/node
X Title: Node CLI eval option can't take unary negation operator · Issue #43397 · nodejs/node
Description: Version v17.9.0 Platform Darwin [redacted] 19.6.0 Darwin Kernel Version 19.6.0: Tue Feb 15 21:39:11 PST 2022; root:xnu-6153.141.59~1/RELEASE_X86_64 x86_64 Subsystem No response What steps will reproduce the bug? Execute the following: $ ...
Open Graph Description: Version v17.9.0 Platform Darwin [redacted] 19.6.0 Darwin Kernel Version 19.6.0: Tue Feb 15 21:39:11 PST 2022; root:xnu-6153.141.59~1/RELEASE_X86_64 x86_64 Subsystem No response What steps will repr...
X Description: Version v17.9.0 Platform Darwin [redacted] 19.6.0 Darwin Kernel Version 19.6.0: Tue Feb 15 21:39:11 PST 2022; root:xnu-6153.141.59~1/RELEASE_X86_64 x86_64 Subsystem No response What steps will repr...
Opengraph URL: https://github.com/nodejs/node/issues/43397
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Node CLI eval option can't take unary negation operator","articleBody":"### Version\n\nv17.9.0\n\n### Platform\n\nDarwin [redacted] 19.6.0 Darwin Kernel Version 19.6.0: Tue Feb 15 21:39:11 PST 2022; root:xnu-6153.141.59~1/RELEASE_X86_64 x86_64\n\n### Subsystem\n\n_No response_\n\n### What steps will reproduce the bug?\n\nExecute the following:\r\n\r\n```bash\r\n$ node -pe \"-0\"\r\n```\r\n\r\nAnd you will get back:\r\n\r\n```\r\nnode: --eval requires an argument\r\n```\r\n\r\nIn fact, anything where the `-` comes first, you get this message.\r\n\r\nFor example, all of the following also result in the above message:\r\n\r\n```bash\r\n$ node -pe \"-42\"\r\n$ node -pe \"-\"\r\n$ node -pe \"-NaN\"\r\n```\r\n\n\n### How often does it reproduce? Is there a required condition?\n\nIt's always reproducable (at least on this version and machine).\n\n### What is the expected behavior?\n\nI'd like it to *not* spit back an error message and give me the evaluated value, please.\n\n### What do you see instead?\n\nAn error message detailing that the \"eval\" option was not given a value.\n\n### Additional information\n\n\r\nIt seems that the CLI is not properly parsing its arguments?\r\n\r\nPrefixing the expression with `0` seems to work:\r\n\r\n```bash\r\n$ node -pe \"0-42\"\r\n42\r\n```\r\n\r\nAs well as using a comma operator:\r\n\r\n```bash\r\n$ node -pe \"(0, -42)\"\r\n-42\r\n```\r\n","author":{"url":"https://github.com/k-tten","@type":"Person","name":"k-tten"},"datePublished":"2022-06-13T00:45:14.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":4},"url":"https://github.com/43397/node/issues/43397"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:1b3a4dd4-ac29-af76-2313-1174fe39928f |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | B13A:269611:3D0684:56D10C:6A4D1CBB |
| html-safe-nonce | 24fd2a6fd27d553324aa6e5f3925f2591948558a6b63f533a74c5631d2b5b734 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCMTNBOjI2OTYxMTozRDA2ODQ6NTZEMTBDOjZBNEQxQ0JCIiwidmlzaXRvcl9pZCI6IjU2MDI2ODUwODAyMTAwNTQzMzEiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | ff3fb48909dfaef490e76c2399f2139e634b895c946c6bc0ed4e446c00a213dd |
| hovercard-subject-tag | issue:1268751833 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/nodejs/node/43397/issue_layout |
| twitter:image | https://opengraph.githubassets.com/512c163df3b78e3095058a182a9c96ae675a8e2f0b0cb38625d871a40da36bf4/nodejs/node/issues/43397 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/512c163df3b78e3095058a182a9c96ae675a8e2f0b0cb38625d871a40da36bf4/nodejs/node/issues/43397 |
| og:image:alt | Version v17.9.0 Platform Darwin [redacted] 19.6.0 Darwin Kernel Version 19.6.0: Tue Feb 15 21:39:11 PST 2022; root:xnu-6153.141.59~1/RELEASE_X86_64 x86_64 Subsystem No response What steps will repr... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | k-tten |
| hostname | github.com |
| expected-hostname | github.com |
| None | bcb4661e6fb4fe8b394c51ea02ccdb2236d40dc59afc75a3bbba50bf6517134c |
| turbo-cache-control | no-preview |
| go-import | github.com/nodejs/node git https://github.com/nodejs/node.git |
| octolytics-dimension-user_id | 9950313 |
| octolytics-dimension-user_login | nodejs |
| octolytics-dimension-repository_id | 27193779 |
| octolytics-dimension-repository_nwo | nodejs/node |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 27193779 |
| octolytics-dimension-repository_network_root_nwo | nodejs/node |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | fb70bd3c4b2bec429781b65419e912c66e2d5581 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width