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

Windows Support not working #13

Closed
StephaneMartignier opened this issue Nov 15, 2018 · 5 comments
Closed

Windows Support not working #13

StephaneMartignier opened this issue Nov 15, 2018 · 5 comments

Comments

@StephaneMartignier
Copy link

Hi,

So trying to use multi-document in MongoDB I found that I need replicat-set and then I find your npm pacakge and I was like "that's perferct :)"

I run the command to install globally and it's seem good. Then I try to run "run-rs -v 4.0.0" but the command failed with the following error :
run-rs1

My guess will be that there is an error in the command to create the folder for the database?

Or am I doing something wrong?

I have version 0.3.0

Thanks in advance

@chaiwa-berian
Copy link
Contributor

@StephaneMartignier I am experiencing the exact same error. It worked the first time I used it, about a week ago, but it has been failing the whole of this week. Uninstalled and re-installed it several times to no luck!

@chaiwa-berian
Copy link
Contributor

chaiwa-berian commented Nov 15, 2018

@StephaneMartignier After carefully looking at the code, I noticed that the code on line number 66 of the index.js could potentially be the cause of the error. Here is the reason:

If you run run-rs -v 4.0.2 --shell without specifying the value for --dbpath, the code will return ./data as the dbPath to be used on line number 69 and line number 80!

This will fail on windows because dbPath will always be ./data whenever the --dbpath option is not passed, and so the code on lines 69 and 80 will always resolve to the path below which is not a correct syntax for a windows path that md command expects:
md .\./data !

To resolve this potential bug for windows users, the code on line 66 can be refactored to something like below:

let dbPath;
if(typeof commander.dbpath === 'string'){
   dbPath = `${commander.dbpath}` ;
}
else {
   dbPath = isWin ? 'data' : './data';
}

Note: I have not tested this code but I believe it should be able to fix the issue! Let me know what you think about this! :)

chaiwa-berian added a commit to chaiwa-berian/run-rs that referenced this issue Nov 15, 2018
@chaiwa-berian
Copy link
Contributor

I have submitted a pull request for this issue. See Pull request #14

@StephaneMartignier
Copy link
Author

I also think that your pr will solve the issue.

Also, in the documentation for the --dbpath option it's written "dbPath" in the example command. It's should be "dbpath"

vkarpov15 added a commit that referenced this issue Nov 17, 2018
Update index.js to fix Windows Support not working issue #13
@vkarpov15
Copy link
Owner

Merged @chaiwa-berian 's PR and released 0.3.2 👍

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

3 participants