Code Monkey home page Code Monkey logo

ghostface's Issues

Odd behaviour when spawning ghostface with child_process.spawn

Hi there,

I'm trying to spawn ghostface using child_process.spawn().
It's strange because none of the output is getting piped to the console, nor do any exit events trigger.

My guess is that the main ghostface isn't the process actually producing the output, nor the exit codes. Is there some other sub-process generating the output?

var spawn = require('child_process').spawn;
var spawned_process;

spawned_process = spawn('./node_modules/.bin/ghostface', ['test/browser_test_compiled.js']);
spawned_process.stdout.pipe(process.stdout);
spawned_process.stderr.pipe(process.stderr);

spawned_process.on('exit', function(code, signal){
    console.log("EXITED with code", code);
});

spawned_process.on('error', function(err){
    console.log("ERROR", err);
});

The same setup works for things like browserify, for example if I do:

spawned_process = spawn('./node_modules/.bin/browserify', ['test/browser_tes.js']);

It outputs the stdout and exits with a 0.

Any thoughts?

CLI exit ternary ignores code

There is an issue with your ternary at: https://github.com/fardog/ghostface/blob/master/bin/ghostface.js#L45

function onExit(code, signal) {
  if(code > 0) {
    console.error(sprintf('\nphantomjs exited abnormally: %d'), code)
  }

  process.exit(code || signal === 'SIGTERM' ? 0 : 1)
}

Basically you're making the exit code 0 if code != 0! (if code is truthy OR signal == 'SIGTERM' then 0 else 1)
You probably want this?

process.exit(code || (signal === 'SIGTERM' ? 0 : 1))

No differentiation between a phantom crash and a timeout

When phantom crashes, or when a timeout occurs, there is no difference to the CLI, it just exits with code 1; there should be a difference between a timeout, and we likely should just be passing the phantom error code directly through (rather than coercing it into a 0/1).

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.