Skip to content

Background (non-parallel) task/code execution #194

@minchinweb

Description

@minchinweb

I'm using Windows 7, Python 3.4.2, and Invoke 0.9.0 (installed via pip).

I want to run 'backgound' tasks. In Windows, if you place the start command at the beginning of the command, it will start your task in a new cmd window and then return focus to your original cmd window. Invoke will start the task, but waits for the new cmd window to close before continuing on. I would like Invoke to start the new task, and then continue with its next command, and eventually exit on 'completion.'

My tasks.py file looks like this:

from invoke import run, task
import os

env_deploy_path = 'output'

@task
def develop():
    if os.path.isdir(env_deploy_path):
        run('rm -rf ' + env_deploy_path)
        run('mkdir ' + env_deploy_path)
    run('start pelican -r -s pelicanconf.py')
    run('cd ' + env_deploy_path + ' && start python -m http.server')

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions