示例#1
0
    def get_command(self):
        """Get the command and kwargs to run.
        """
        # Run the node script with command arguments.
        config = dict(baseUrl=self.connection_url, token=self.token)

        with open(osp.join(HERE, 'config.json'), 'w') as fid:
            json.dump(config, fid)

        cmd = [which('nodemon'), '-w', './out', '--exec', which('node'), './out/index.js', '--inspect', '--jupyter-config-data=./config.json', '|', './node_modules/.bin/bunyan']
        # cmd = [which('node'),
        #        'index.js', '--jupyter-config-data=./config.json']
        return cmd, dict(cwd=HERE)
示例#2
0
    def get_command(self):
        """Get the command and kwargs to run.
        """
        # Run the node script with command arguments.
        config = dict(baseUrl=self.connection_url, token=self.token)

        with open('config.json', 'w') as fid:
            json.dump(config, fid)

        cmd = [which('node'),
               'index.js', '--jupyter-config-data=./config.json']
        return cmd, dict(cwd=HERE)
示例#3
0
    def get_command(self):
        """Get the command and kwargs to run.
        """
        # Run the node script with command arguments.
        config = dict(baseUrl=self.connection_url, token=self.token)

        with open(osp.join(HERE, 'config.json'), 'w') as fid:
            json.dump(config, fid)

        cmd = [
            which('node'), 'index.js', '--jupyter-config-data=./config.json'
        ]
        return cmd, dict(cwd=HERE)
示例#4
0
    def get_command(self):
        """Get the command and kwargs to run.
        """
        # Run the node script with command arguments.
        config = dict(baseUrl='http://localhost:{}{}'.format(
            self.serverapp.port, self.settings['base_url']),
                      token="")

        with open(osp.join(HERE, 'config.json'), 'w') as fid:
            json.dump(config, fid)

        cmd = [
            which('node'), 'index.js', '--jupyter-config-data=./config.json'
        ]
        return cmd, dict(cwd=HERE)
示例#5
0
    def get_command(self):
        """Get the command and kwargs to run."""
        # Run the node script with command arguments.
        config = dict(
            baseUrl="http://localhost:{}{}".format(self.serverapp.port,
                                                   self.settings["base_url"]),
            token=self.settings["token"],
        )

        with open(osp.join(HERE, "config.json"), "w") as fid:
            json.dump(config, fid)

        cmd = [
            which("node"), "index.js", "--jupyter-config-data=./config.json"
        ]
        return cmd, dict(cwd=HERE)
示例#6
0
def execvp(cmd, argv):
    """Execvp, except on Windows where it uses Popen.

    The first argument, by convention, should point to the filename
    associated with the file being executed.

    Python provides execvp on Windows, but its behavior is problematic
    (Python bug#9148).
    """
    cmd = which(cmd)
    if os.name == 'nt':
        import signal
        import sys
        p = subprocess.Popen([cmd] + argv[1:])
        # Don't raise KeyboardInterrupt in the parent process.
        # Set this after spawning, to avoid subprocess inheriting handler.
        signal.signal(signal.SIGINT, signal.SIG_IGN)
        p.wait()
        sys.exit(p.returncode)
    else:
        os.execvp(cmd, argv)