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

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

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


##########
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:
   Yes, it makes sense. If the process is not null or undefined, then it must have a version and 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