mirror of
https://github.com/pulsar-edit/pulsar.git
synced 2024-11-10 10:17:11 +03:00
🎨 Fix spec, cleanup
This commit is contained in:
parent
d0a011e93a
commit
3123a92687
@ -205,7 +205,7 @@ describe('updateProcessEnv(launchEnv)', function () {
|
||||
process.env = {FOO: 'bar'}
|
||||
|
||||
await updateProcessEnv(process.env)
|
||||
expect(child_process.execFile).not.toHaveBeenCalled()
|
||||
expect(child_process.spawn).not.toHaveBeenCalled()
|
||||
expect(process.env).toEqual({FOO: 'bar'})
|
||||
})
|
||||
})
|
||||
|
@ -101,18 +101,20 @@ async function getEnvFromShell (env) {
|
||||
console.log(error)
|
||||
}
|
||||
|
||||
if (stdout && stdout.trim() !== '') {
|
||||
let result = {}
|
||||
for (let line of stdout.split('\n')) {
|
||||
if (line.includes('=')) {
|
||||
let components = line.split('=')
|
||||
let key = components.shift()
|
||||
let value = components.join('=')
|
||||
result[key] = value
|
||||
}
|
||||
}
|
||||
return result
|
||||
if (!stdout || stdout.trim() === '') {
|
||||
return null
|
||||
}
|
||||
|
||||
let result = {}
|
||||
for (let line of stdout.split('\n')) {
|
||||
if (line.includes('=')) {
|
||||
let components = line.split('=')
|
||||
let key = components.shift()
|
||||
let value = components.join('=')
|
||||
result[key] = value
|
||||
}
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
export default { updateProcessEnv, shouldGetEnvFromShell }
|
||||
|
Loading…
Reference in New Issue
Block a user