Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add process.getSystemVersion() #16599

Merged
merged 1 commit into from
Feb 18, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions atom/common/api/atom_bindings.cc
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ void AtomBindings::BindProcess(v8::Isolate* isolate,
process->SetMethod("getHeapStatistics", &GetHeapStatistics);
process->SetMethod("getProcessMemoryInfo", &GetProcessMemoryInfo);
process->SetMethod("getSystemMemoryInfo", &GetSystemMemoryInfo);
process->SetMethod("getSystemVersion",
&base::SysInfo::OperatingSystemVersion);
process->SetMethod("getIOCounters", &GetIOCounters);
process->SetMethod("getCPUUsage", base::Bind(&AtomBindings::GetCPUUsage,
base::Unretained(metrics)));
Expand Down
12 changes: 12 additions & 0 deletions docs/api/process.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ In sandboxed renderers the `process` object contains only a subset of the APIs:
- `getHeapStatistics()`
- `getProcessMemoryInfo()`
- `getSystemMemoryInfo()`
- `getSystemVersion()`
- `getCPUUsage()`
- `getIOCounters()`
- `argv`
Expand Down Expand Up @@ -206,6 +207,17 @@ Returns `Object`:
Returns an object giving memory usage statistics about the entire system. Note
that all statistics are reported in Kilobytes.

### `process.getSystemVersion()`

Returns `String` - The version of the host operating system.

Examples:
- macOS: `10.13.6`
- Windows: `10.0.17763`
- Linux: `4.15.0-45-generic`

**Note:** It returns the actual operating system version instead of kernel version on macOS unlike `os.release()`.
miniak marked this conversation as resolved.
Show resolved Hide resolved

### `process.takeHeapSnapshot(filePath)`

* `filePath` String - Path to the output file.
Expand Down
6 changes: 6 additions & 0 deletions spec/api-process-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,12 @@ describe('process module', () => {
})
})

describe('process.getSystemVersion()', () => {
it('returns a string', () => {
expect(process.getSystemVersion()).to.be.a('string')
})
})

describe('process.getHeapStatistics()', () => {
it('returns heap statistics object', () => {
const heapStats = process.getHeapStatistics()
Expand Down