Suppress deprecations in BufferedNodeProcess

This keeps it consistent with the render process which also suppresses
deprecations

Closes #5383
This commit is contained in:
Kevin Sawicki
2015-02-04 15:27:17 -08:00
parent cbe5eff04c
commit 6e3d41f433
4 changed files with 45 additions and 0 deletions

View File

@@ -0,0 +1,39 @@
path = require 'path'
BufferedNodeProcess = require '../src/buffered-node-process'
describe "BufferedNodeProcess", ->
it "executes the script in a new process", ->
exit = jasmine.createSpy('exitCallback')
output = ''
stdout = (lines) -> output += lines
error = ''
stderr = (lines) -> error += lines
args = ['hi']
command = path.join(__dirname, 'fixtures', 'script.js')
new BufferedNodeProcess({command, args, stdout, stderr, exit})
waitsFor ->
exit.callCount is 1
runs ->
expect(output).toBe 'hi'
expect(error).toBe ''
expect(args).toEqual ['hi']
it "suppresses deprecations in the new process", ->
exit = jasmine.createSpy('exitCallback')
output = ''
stdout = (lines) -> output += lines
error = ''
stderr = (lines) -> error += lines
command = path.join(__dirname, 'fixtures', 'script-with-deprecations.js')
new BufferedNodeProcess({command, stdout, stderr, exit})
waitsFor ->
exit.callCount is 1
runs ->
expect(output).toBe 'hi'
expect(error).toBe ''

View File

@@ -0,0 +1,2 @@
require('fs').existsSync('hi');
process.stdout.write('hi');

1
spec/fixtures/script.js vendored Normal file
View File

@@ -0,0 +1 @@
process.stdout.write(process.argv[2]);

View File

@@ -48,5 +48,8 @@ class BufferedNodeProcess extends BufferedProcess
options.env ?= Object.create(process.env)
options.env['ATOM_SHELL_INTERNAL_RUN_AS_NODE'] = 1
args = args?.slice() ? []
args.unshift(command)
args.unshift('--no-deprecation')
super({command: node, args, options, stdout, stderr, exit})