Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Combine --watch and --replace for same file causes infinite loop in console #126

Closed
vlatkoodrljin opened this issue May 9, 2017 · 5 comments
Assignees
Labels
Milestone

Comments

@vlatkoodrljin
Copy link

Following CLI command causes infinite loop:

postcss public/css/styles.css -u autoprefixer -r -w --poll

When I change styles.css the watch starts command again and again in console.
Without --watch option everything is working as expected.

@RyanZim
Copy link
Collaborator

RyanZim commented May 9, 2017

@vlatkodrljin Using -w and -r together isn't possible, since postcss-cli will pick up replacements as a file change, triggering an infinite loop.

This is an edge-case I never thought of; we should fix this to make it error out instead of getting stuck in the infinite loop.

@RyanZim RyanZim added the bug label May 9, 2017
@RyanZim RyanZim self-assigned this May 9, 2017
@vlatkoodrljin
Copy link
Author

I have infinite loop only when my postcss parsing is longer than 100ms.

Chokidar which this CLI uses has default pool interval of 100ms, and reason for my infinite loop is because my parsing interval is out of that 100ms.

We can add option for setting polling interval in this particular case, this would be the best solution if you ask me.

@RyanZim
Copy link
Collaborator

RyanZim commented May 9, 2017

@vlatkodrljin That's a hacky way around the real issue. Most users aren't using --poll.

@santanajames
Copy link

@RyanZim I agree that @vlatkodrljin method is a hack around the real issue. However, generally, if ---poll is an option then --interval is also an option - same as Chokidar which is used in this case. It is beneficial to have control over the polling interval if you are one of those users who uses it.

I have made a pull request with this addition.

@weaintplastic
Copy link

I'm running into the same issue. Would be great to have a solution for it.

RyanZim added a commit that referenced this issue Dec 6, 2017
- Remove extra aliases -x, -p, -s, -t, -e, -b, & -c
- Better usage text
- Split opts into groups in the --help message
- Way stricter opts parsing to prevent stupid combinations of options

Fixes #166; Fixes #126
@RyanZim RyanZim added this to the 5.0.0 milestone Dec 6, 2017
@RyanZim RyanZim closed this as completed in cc3f696 Feb 6, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants