Fix lint errors

This commit is contained in:
Joe Fitzgerald
2016-11-14 17:09:01 -07:00
parent c83e71cb9d
commit f73aa46cef
2 changed files with 12 additions and 12 deletions

View File

@@ -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'})
})
})

View File

@@ -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')
}