• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1'use strict';
2// Tests that os.userInfo correctly handles errors thrown by option property
3// getters. See https://github.com/nodejs/node/issues/12370.
4
5const common = require('../common');
6const assert = require('assert');
7const execFile = require('child_process').execFile;
8
9const script = `os.userInfo({
10  get encoding() {
11    throw new Error('xyz');
12  }
13})`;
14
15const node = process.execPath;
16execFile(node, [ '-e', script ], common.mustCall((err, stdout, stderr) => {
17  assert(stderr.includes('Error: xyz'), 'userInfo crashes');
18}));
19