Skip to content

Commit 5805277

Browse files
committed
handle case where computer name is not set
1 parent 5f54847 commit 5805277

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

lib/computername.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,11 @@ var computerName = "*unknown*";
3535

3636
if (process.platform.toLowerCase() === 'darwin') {
3737
utils.execute('scutil', ['--get', 'ComputerName'], function(err, res) { // eslint-disable-line
38-
computerName = res.stdout.split()[0];
38+
if (err) {
39+
computerName = "unable to get computer name";
40+
} else {
41+
computerName = res.stdout.split()[0];
42+
}
3943
});
4044
} else if (process.platform.substring(0, 3).toLowerCase() === "win") {
4145
computerName = process.env.COMPUTERNAME;

0 commit comments

Comments
 (0)