This seems a little fragile. Won't `data` have line endings on it? I think it would be better to have the regexp extract the PID from between delimiters, something like:

    var matches = data.match(/Ready \[(\d+)\]/);
    if (!matches) {
        phantom.kill();
        return callback("Unexpected output from PhantomJS: " + data);
    }
    
    var phantom_pid = parseInt(matches[1], 10);

What do you think?