This repository was archived by the owner on Jun 18, 2021. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 36
aix: improve readability of os version #57
Closed
Closed
Changes from 1 commit
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next
Next commit
aix: improve readability of os version
uname on AIX reports, e.g. 6.1 as version == 6, release == 1. The code was previously printing this as: OS version: AIX 1 6 Fix so that on AIX this is now: OS version: AIX 6.1
- Loading branch information
commit d80c5909fc3b584f64dc0d2f5d4d42226c2a605f
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| 'use strict'; | ||
|
|
||
| // Testcase for validating reported OS version | ||
|
|
||
| const common = require('./common.js'); | ||
| const nodereport = require('../'); | ||
| const os = require('os'); | ||
| const tap = require('tap'); | ||
|
|
||
| const os_map = { | ||
| 'aix': 'AIX', | ||
| 'darwin': 'Darwin', | ||
| 'linux': 'Linux', | ||
| 'win32': 'Windows', | ||
| }; | ||
| const os_name = os_map[os.platform()]; | ||
| const report_str = nodereport.getReport(); | ||
| const version_str = report_str.match(/OS version: .*(?:\r*\n)/); | ||
| if (common.isWindows()) { | ||
| tap.match(version_str, new RegExp('OS version: ' + os_name), 'Checking OS version'); | ||
| } else if (common.isAIX() && !os.release().includes('.')) { | ||
| // For Node.js prior to os.release() fix for AIX: https://github.com/nodejs/node/pull/10245 | ||
| tap.match(version_str, new RegExp('OS version: ' + os_name + ' \\d+.' + os.release()), 'Checking OS version'); | ||
| } else if (!common.isWindows()) { | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could this just be else since you already check 'if (common.isWindows()) {' ?
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, it can. Fixed. |
||
| tap.match(version_str, new RegExp('OS version: ' + os_name + ' .*' + os.release()), 'Checking OS version'); | ||
| } | ||
|
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think
.includes()is there in Node v4.But obviously we can check by running CI with Node v4.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In a node v4.0.0 repl that seems to work:
It should be fine on v4.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, you're right. I think it's
Array.includes()that isn't there in v4,string.includes()is.