mirror of
https://github.com/atom/atom.git
synced 2026-01-15 01:48:15 -05:00
Fix lint errors
This commit is contained in:
@@ -4,7 +4,7 @@
|
||||
import {it, fit, ffit, fffit, beforeEach, afterEach} from './async-spec-helpers'
|
||||
import path from 'path'
|
||||
import temp from 'temp'
|
||||
import child_process from 'child_process'
|
||||
import childProcess from 'child_process'
|
||||
import {updateProcessEnv, shouldGetEnvFromShell} from '../src/update-process-env'
|
||||
import dedent from 'dedent'
|
||||
import {EventEmitter} from 'events'
|
||||
@@ -14,9 +14,9 @@ describe('updateProcessEnv(launchEnv)', function () {
|
||||
let originalProcessEnv, originalProcessPlatform, originalSpawn, spawn
|
||||
|
||||
beforeEach(function () {
|
||||
originalSpawn = child_process.spawn
|
||||
originalSpawn = childProcess.spawn
|
||||
spawn = mockSpawn()
|
||||
child_process.spawn = spawn
|
||||
childProcess.spawn = spawn
|
||||
originalProcessEnv = process.env
|
||||
originalProcessPlatform = process.platform
|
||||
process.env = {}
|
||||
@@ -24,7 +24,7 @@ describe('updateProcessEnv(launchEnv)', function () {
|
||||
|
||||
afterEach(function () {
|
||||
if (originalSpawn) {
|
||||
child_process.spawn = originalSpawn
|
||||
childProcess.spawn = originalSpawn
|
||||
}
|
||||
process.env = originalProcessEnv
|
||||
process.platform = originalProcessPlatform
|
||||
@@ -201,11 +201,11 @@ describe('updateProcessEnv(launchEnv)', function () {
|
||||
describe('on windows', function () {
|
||||
it('does not update process.env', async function () {
|
||||
process.platform = 'win32'
|
||||
spyOn(child_process, 'spawn')
|
||||
spyOn(childProcess, 'spawn')
|
||||
process.env = {FOO: 'bar'}
|
||||
|
||||
await updateProcessEnv(process.env)
|
||||
expect(child_process.spawn).not.toHaveBeenCalled()
|
||||
expect(childProcess.spawn).not.toHaveBeenCalled()
|
||||
expect(process.env).toEqual({FOO: 'bar'})
|
||||
})
|
||||
})
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/** @babel */
|
||||
|
||||
import fs from 'fs'
|
||||
import child_process from 'child_process'
|
||||
import childProcess from 'child_process'
|
||||
|
||||
const ENVIRONMENT_VARIABLES_TO_PRESERVE = new Set([
|
||||
'NODE_ENV',
|
||||
@@ -23,7 +23,7 @@ async function updateProcessEnv (launchEnv) {
|
||||
} else if (launchEnv.PWD) {
|
||||
envToAssign = launchEnv
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (envToAssign) {
|
||||
for (let key in process.env) {
|
||||
@@ -64,15 +64,15 @@ async function getEnvFromShell (env) {
|
||||
let {stdout, error} = await new Promise((resolve) => {
|
||||
let error
|
||||
let stdout = ''
|
||||
const childProcess = child_process.spawn(env.SHELL, ['-ilc', 'command env'], {encoding: 'utf8', stdio: ['ignore', 'pipe', process.stderr]})
|
||||
const child = childProcess.spawn(env.SHELL, ['-ilc', 'command env'], {encoding: 'utf8', stdio: ['ignore', 'pipe', process.stderr]})
|
||||
const buffers = []
|
||||
childProcess.on('error', (e) => {
|
||||
child.on('error', (e) => {
|
||||
error = e
|
||||
})
|
||||
childProcess.stdout.on('data', (data) => {
|
||||
child.stdout.on('data', (data) => {
|
||||
buffers.push(data)
|
||||
})
|
||||
childProcess.on('close', (code, signal) => {
|
||||
child.on('close', (code, signal) => {
|
||||
if (buffers.length) {
|
||||
stdout = Buffer.concat(buffers).toString('utf8')
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user