{"size": 557, "ext": "js", "max_stars_repo_path": "packages/lub-command/test/fixtures/my-helper/lib/spawn-node.js", "max_stars_repo_name": "lubjs/lub", "max_stars_repo_stars_event_min_datetime": "2019-11-17T16:06:07.000Z", "max_stars_repo_stars_event_max_datetime": "2019-12-11T09:14:34.000Z", "max_issues_repo_path": "packages/lub-command/test/fixtures/my-helper/lib/spawn-node.js", "max_issues_repo_name": "lubjs/lub", "max_issues_repo_issues_event_min_datetime": "2019-11-18T14:57:26.000Z", "max_issues_repo_issues_event_max_datetime": "2019-12-11T06:17:59.000Z", "max_forks_repo_path": "packages/lub-command/test/fixtures/my-helper/lib/spawn-node.js", "max_forks_repo_name": "lubjs/lub", "max_forks_repo_forks_event_min_datetime": "2019-11-29T11:39:29.000Z", "max_forks_repo_forks_event_max_datetime": "2019-11-29T11:39:29.000Z"}
{"max_stars_count": 6, "max_issues_count": 18, "max_forks_count": 1, "avg_line_length": 18.5666666667, "max_line_length": 56, "alphanum_fraction": 0.5565529623}
"use strict";

const path = require("path");
const Command = require("../../../../index");

class SpawnNode extends Command {
  constructor(rawArgv) {
    super(rawArgv);
    this.options = {
      target: {
        description: "fork script file"
      }
    };
  }

  *run({ argv, rawArgv }) {
    if (!argv.target) {
      yield this.helper.spawn("echo");
      return;
    }
    yield this.helper.spawn(
      "node",
      [path.join(__dirname, "../scripts", argv.target)],
      rawArgv.concat("--from=test")
    );
  }
}

module.exports = SpawnNode;
