Skip to content

Commit

Permalink
Only check a Stats object prototype in Electron.
Browse files Browse the repository at this point in the history
  • Loading branch information
jdalton committed Sep 2, 2018
1 parent d0a7299 commit 1bcc936
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/fs/stat-sync.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
import { statSync as _statSync, Stats } from "../safe/fs.js"

import ENV from "../constant/env.js"

import setPrototypeOf from "../util/set-prototype-of.js"
import shared from "../shared.js"

function init() {
const {
ELECTRON
} = ENV

const { prototype } = Stats

function statSync(thePath) {
Expand All @@ -22,7 +28,8 @@ function init() {
// Electron and Muon return a plain object for asar files.
// https://github.com/electron/electron/blob/master/lib/common/asar.js
// https://github.com/brave/muon/blob/master/lib/common/asar.js
if (! (result instanceof Stats)) {
if (ELECTRON &&
! (result instanceof Stats)) {
setPrototypeOf(result, prototype)
}
} catch (e) {}
Expand Down

0 comments on commit 1bcc936

Please sign in to comment.