MCPcopy Create free account
hub / github.com/ember-cli/ember-cli / isUsingBatterySysClassPowerSupply

Function isUsingBatterySysClassPowerSupply

lib/models/hardware-info.js:77–88  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

75}
76
77function isUsingBatterySysClassPowerSupply() {
78 try {
79 const value = fs.readFileSync('/sys/class/power_supply/AC/online');
80
81 return parseInt(value, 10) === 0;
82 } catch (ex) {
83 logger.warn(`Could not get battery status from /sys/class/power_supply: ${ex}`);
84 logger.warn(ex.stack);
85
86 return null;
87 }
88}
89
90function isUsingBatteryUpower() {
91 try {

Callers 1

isUsingBatteryLinuxFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…