Skip to content

double quotes do not work with watchexec #17

Description

@FuPeiJiang

running watchexec --restart "cargo run" directly in cmd.exe works

[package.metadata.commands]
dev = 'watchexec --restart "cargo run"'

but when I run (in cmd.exe)
cargo cmd dev
I get:

> watchexec --restart "cargo run" 
'\"cargo run\"' is not recognized as an internal or external command,
operable program or batch file.

my understanding is that " became \"
since it gives the exact output if I run \"cargo run\" in cmd.exe
or
"cargo run" was passed to watchexec instead of cargo run (without quotes)

using this:
dev = 'watchexec --restart "cargo --quiet run"'
I get:

> watchexec --restart "cargo --quiet run"" 
error: Found argument '--quiet' which wasn't expected, or isn't valid in this context

USAGE:
    watchexec <command>... --restart

For more information try --help

why doesn't double quotes work ? which shell is used to execute commands?


my current workaround:

[package.metadata.commands]
quietRun = 'cargo --quiet run'
dev = 'watchexec --restart cargo cmd quietRun'

cargo cmd dev works but it prints
> cargo --quiet run
every time I edit or save files


can you provide a way to make specific commands quiet? (not print for example > cargo --quiet run)
make anything that starts with quiet_ be quiet, so
this be quiet: quiet_quietRun = 'cargo --quiet run'
this not be quiet: quietRun = 'cargo --quiet run'

but this will be slower since cargo cmd quietRun will be run every time. instead of directly cargo --quiet run

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions