You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tinkerpop.apache.org by "vkagamlyk (via GitHub)" <gi...@apache.org> on 2023/02/03 18:17:50 UTC

[GitHub] [tinkerpop] vkagamlyk commented on a diff in pull request #1960: patch: Fixing generateUserAgent() to handle null and undefined properly

vkagamlyk commented on code in PR #1960:
URL: https://github.com/apache/tinkerpop/pull/1960#discussion_r1096113763


##########
gremlin-javascript/src/main/javascript/gremlin-javascript/lib/utils.js:
##########
@@ -90,10 +90,24 @@ function generateUserAgent() {
   } catch (e) {
     driverVersion = 'NotAvailable';
   }
-  const runtimeVersion = process.version.replace(' ', '_');
-  const osName = os.platform().replace(' ', '_');
-  const osVersion = os.release().replace(' ', '_');
-  const cpuArch = process.arch.replace(' ', '_');
+  let runtimeVersion;
+  let osName;
+  let osVersion;
+  let cpuArch;
+  runtimeVersion = osName = osVersion = cpuArch = 'NotAvailable';
+  if (process != null) {
+    if (process.version != null) {

Review Comment:
   Can `version` be undefined?
   ```suggestion
       if (process.version) {
   ```
   same question for `arch`



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@tinkerpop.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org