Skip to content

Commit

Permalink
fix(nx): use fork so max_old_space_size is passed through
Browse files Browse the repository at this point in the history
  • Loading branch information
FrozenPandaz authored and vsavkin committed Jun 15, 2019
1 parent da352ba commit 1af94ad
Showing 1 changed file with 6 additions and 10 deletions.
16 changes: 6 additions & 10 deletions packages/schematics/src/utils/update-task.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
import {
chain,
Rule,
SchematicContext,
TaskConfiguration,
TaskConfigurationGenerator,
TaskExecutorFactory,
Tree
} from '@angular-devkit/schematics';
import { platform } from 'os';
import { Observable } from 'rxjs';
import { spawn } from 'child_process';
import { fork } from 'child_process';
import { join } from 'path';

let taskRegistered = false;

Expand Down Expand Up @@ -65,22 +64,19 @@ function createRunUpdateTask(): TaskExecutorFactory<UpdateTaskOptions> {
return Promise.resolve(
(options: UpdateTaskOptions, context: SchematicContext) => {
context.logger.info(`Updating ${options.package} to ${options.to}`);
const spawnOptions = {
stdio: [process.stdin, process.stdout, process.stderr],
const forkOptions = {
stdio: [process.stdin, process.stdout, process.stderr, 'ipc'],
shell: true
};
const ng =
platform() === 'win32'
? '.\\node_modules\\.bin\\ng'
: './node_modules/.bin/ng';
const ng = join('./node_modules', '@angular/cli', 'bin/ng');
const args = [
'update',
`${options.package}@${options.to}`,
'--force',
'--allow-dirty'
].filter(e => !!e);
return new Observable(obs => {
spawn(ng, args, spawnOptions).on('close', (code: number) => {
fork(ng, args, forkOptions).on('close', (code: number) => {
if (code === 0) {
obs.next();
obs.complete();
Expand Down

0 comments on commit 1af94ad

Please sign in to comment.