// Copyright 2013 Traceur Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//      http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

'use strict';

// This is used by the prepublish script in package.json. The scripts section
// in package.json uses platform specific code (cmd.exe on Windows etc) so these
// need to be as simple as possible.

// We set the NO_PREPUBLISH environment flag in the Makefile to prevent
// endless loop of makes and npm installs.
if (!process.env.NO_PREPUBLISH)
  require('child_process').exec('make prepublish');

@@ -800,16 +800,61 @@
 sible.%0A%0A
+var spawn = require('child_process').spawn;%0A%0A
 // We se
@@ -995,57 +995,134 @@
 ISH)
+ %7B
 %0A  
-require('child_
+spawn('make', %5B'prepublish'%5D, %7Bstdio: 'inherit'%7D).%0A      on('close', function(code) %7B%0A        
 process
-')
 .ex
-ec('make prepublish'
+it(code);%0A      %7D
 );%0A
+%7D

Handle error code, stdout and stderr for prepublish script