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

[ Feature idea ] synchronous sleep command #441

Closed
nfischer opened this issue May 10, 2016 · 2 comments
Closed

[ Feature idea ] synchronous sleep command #441

nfischer opened this issue May 10, 2016 · 2 comments
Labels

Comments

@nfischer
Copy link
Member

I'm sure something like this has been implemented before (and I can think of a few simple ways to implement it off the top of my head), but I think it would be beneficial for us to implement a synchronous sleep() command that works similarly to unix sleep.

Usage would be as follows:

cd('mydir');
touch('file.txt'); // update the time stamp
sleep(1); // sleep for a second
// Now we're at least 1 second after that updated time stamp

One practical use case I can imagine would be for this line in our test script, since we want to verify that time stamps are actually changed before and after the sleeping.

@ariporad
Copy link
Contributor

Here's my $0.02: I don't think we should add this, because:

  1. Node is designed to very specifically not do this.
  2. There are a lot of modules on npm which do exactly this.
  3. There's not (AFAIK), a way to do this that's both performant and doesn't require a native extension.

That being said, #402 does require something like this, so if we want to do that, we might need this.

@nfischer
Copy link
Member Author

Closing this, because I released shelljs-plugin-sleep.

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

2 participants