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

findSync is not synchronous #5

Open
isaachinman opened this issue Mar 1, 2017 · 3 comments
Open

findSync is not synchronous #5

isaachinman opened this issue Mar 1, 2017 · 3 comments

Comments

@isaachinman
Copy link

No description provided.

@purefan
Copy link

purefan commented Apr 4, 2017

As far as I can see findSync depends on the find library which implements traverseSync which uses fs.readdirSync.

am I missing something?

@emcniece
Copy link

emcniece commented Oct 11, 2017

I too found that the findSync returned before actually completing, allowing the rest of my script to execute.

function doThething(){
  const files = [
    {dir: '.', name: '^config.xml', regex: /version="(.*?[^\\])"/},
  ];

  files.forEach((file, i) => {
    let test = findInFiles.findSync(file.regex, file.dir, file.name)
    .then(res => {
      console.log('result: ', res)
    })

    console.log('done', test);
  })
}

The console.log('done', test); fires long before the promise resolves. At this log, done returns { state: 'pending' }.

@j
Copy link

j commented Feb 28, 2018

I'm having the same issue as well. { state: 'pending' }

@isaachinman isaachinman reopened this Feb 28, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants