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

Runs in cmd, but not in Git Bash... #47

Open
curleb opened this issue Aug 4, 2017 · 3 comments
Open

Runs in cmd, but not in Git Bash... #47

curleb opened this issue Aug 4, 2017 · 3 comments

Comments

@curleb
Copy link

curleb commented Aug 4, 2017

Trying to poll a variety of collections across several local MongoDB instances, and I can only get some smaller collections to run successfully. Large collections are hitting some clearLine error, but only in the Bash shell. Runs okay...manually, under Windows:

`C:\Users\bcurley\AppData\Roaming\npm\node_modules\mongodb-schema\node_modules\progress\lib\node-progress.js:177
this.stream.clearLine();
^

TypeError: this.stream.clearLine is not a function
at ProgressBar.terminate (C:\Users\bcurley\AppData\Roaming\npm\node_modules\mongodb-schema\node_modules\progress\lib\node-progress.js:177:17)
at ProgressBar.tick (C:\Users\bcurley\AppData\Roaming\npm\node_modules\mongodb-schema\node_modules\progress\lib\node-progress.js:91:10)
at Stream. (C:\Users\bcurley\AppData\Roaming\npm\node_modules\mongodb-schema\bin\mongodb-schema:179:13)
at emitOne (events.js:96:13)
at Stream.emit (events.js:188:7)
at Stream.write (C:\Users\bcurley\AppData\Roaming\npm\node_modules\mongodb-schema\lib\stream.js:308:10)
at Stream.stream.write (C:\Users\bcurley\AppData\Roaming\npm\node_modules\mongodb-schema\node_modules\through\index.js:26:11)
at Stream.ondata (internal/streams/legacy.js:16:26)
at emitOne (events.js:101:20)
at Stream.emit (events.js:188:7)
=== `

`for i in $(mongo localhost:27017 --quiet --eval "db.adminCommand('listDatabases')"
|grep -v Hotfix
|grep '"name" :'
|cut -d" -f4
|sed 's/"//g;s/,//g;'
)

Loop through each to compile a listing of existing collections...

do printf "\n%s: \n" "${i}" &&
for j in $(mongo localhost:27017/${i} --quiet --eval "db.getCollectionNames().join('\n')"
|grep -v Hotfix
|sed 's/^/\t/g;'
)

Loop through these to compile a listing of available fields needed on output...

  do printf "\nCREATE TABLE %s ( \n" ${j} \
     && mongodb-schema localhost:27017 --values=false --format=json ${i}.${j} 2>/dev/null \
        |grep '"path":' \
        |cut -d: -f2 \
        |uniq \
        |sed 's/^/         /g;' \
     && printf "         %s ); \n" " \"X\"" 
  done 

done
`
Thoughts?

@rueckstiess
Copy link
Member

rueckstiess commented Aug 4, 2017

Looks like a problem with the progress module (that renders the progress bar) on Windows. Other projects had similar issues with the same error message. This one seems to indicate that an upgrade to progress@2.x would fix it: expo/create-react-native-app#179

@curleb
Copy link
Author

curleb commented Aug 4, 2017 via email

@curleb
Copy link
Author

curleb commented Aug 7, 2017

Turns out the issue is caused by the handling of the sample and repeat variables. My version of Progress was up to speed as it was, but I appreciate the direction.

Works in Windows, but not under Git Bash. Commented the call out for now since my targets are relatively small; mongodb-schema, ln 178-180. I'll see if I can default dummy values explicitly for all platforms in the near-term, although it looks like the optargs section is a little disheveled. I'm not sure why they're misbehaving under Bash, since they're running on the same machine...and Bash is a sub-shell to cmd.

Thanks!

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

2 participants