Skip to content

Commit

Permalink
fixup! fixup! fix(sandbox): normalize windows paths correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
nlf committed Aug 25, 2021
1 parent 84ee370 commit bc35e47
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion test/fixtures/sandbox.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ const redactedDefaults = [
const vagueRedactedDefaults = [
'editor',
'shell',
'viewer',
]

const normalize = (str) => str
Expand Down Expand Up @@ -152,6 +151,10 @@ class Sandbox extends EventEmitter {
}
}

const viewer = _process.platform === 'win32'
? /"browser"[^:]/g
: /"man"/g

// the global prefix is platform dependent
const realGlobalPrefix = _process.platform === 'win32'
? dirname(_process.execPath)
Expand All @@ -163,6 +166,7 @@ class Sandbox extends EventEmitter {

// and finally replace some paths we know could be present
clean = clean
.replace(viewer, '"{VIEWER}"')
.split(normalize(this[_proxy].execPath)).join('{EXECPATH}')
.split(normalize(_process.execPath)).join('{REALEXECPATH}')
.split(normalize(this.global)).join('{GLOBALPREFIX}')
Expand Down

0 comments on commit bc35e47

Please sign in to comment.