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

existdb-sync task breaks if workspace path contains a space #8

Closed
joewiz opened this issue Jun 25, 2020 · 3 comments · Fixed by #9
Closed

existdb-sync task breaks if workspace path contains a space #8

joewiz opened this issue Jun 25, 2020 · 3 comments · Fixed by #9

Comments

@joewiz
Copy link
Contributor

joewiz commented Jun 25, 2020

When testing the vscode extension, I noticed that the existdb-sync task would fail if the path to the workspace contains a space.

The error:

Executing task in folder air table: node /Users/joe/.vscode/extensions/exist-db.existdb-vscode-1.0.2/sync/dist/sync.js -s http://localhost:8080/exist -u admin -p -c /db/apps/airtable /Users/joe/Downloads/air table -i ".existdb.json" ".git/" "node_modules/" "bower_components/**" <

directory /Users/joe/Downloads/air not found
The terminal process terminated with exit code: 1

Terminal will be reused by tasks, press any key to close it.

The path in question is /Users/joe/Downloads/air table.

If I wrap the path in quotes or escape the space (e.g., "/Users/joe/Downloads/air table" or /Users/joe/Downloads/air\ table) and run the command again, it succeeds. However, I can't figure out how to get vscode to add quotes or escape the space.

Could anyone suggest a method that might work? I think the relevant code is here:

const argv = yargs.options({
s: { alias: 'server', type: 'string', default: 'http://localhost:8080/exist' },
u: { alias: 'user', type: 'string', default: 'admin' },
p: { alias: 'password', type: 'string', default: '' },
c: { alias: 'collection', type: 'string', demandOption: true },
i: { alias: 'ignore', type: 'string', array: true, default: [] }
}).argv;
if (argv._.length == 0) {
console.log('please specify a directory to watch');
process.exit(1);
}
const dir = path.resolve(argv._[0]);
if (!fs.existsSync(dir)) {
console.log(`directory ${argv._[0]} not found`);
process.exit(1);
}

@wolfgangmm
Copy link
Owner

I think we would need to change the code which constructs the command line:

command += `-c ${collection} ${folder.uri.fsPath} -i ${sync.ignore.map(p => `"${p}"`).join(' ')}`;
to add quotes around the -c parameter.

@joewiz
Copy link
Contributor Author

joewiz commented Jun 29, 2020

@wolfgangmm I can confirm that by modifying that line in task-provider.ts to wrap ${folder.uri.fsPath} in double quotes fixes the problem. Here's sample output from the Build Task showing the quotes working - or so it appears to me.

> Executing task in folder airtable: node /Users/joe/workspace/existdb-langserver/sync/dist/sync.js -s http://localhost:8080/exist -u admin -p -c /db/apps/airtable "/Users/joe/Library/Mobile Documents/iCloudconoteplan~NotePlan/Documents/Notes/airtable" -i ".existdb.json" ".git/" "node_modules/" "bower_components/**" <

Watching /Users/joe/Library/Mobile Documents/iCloudconoteplan~NotePlan/Documents/Notes/airtable
Using fs events.

Can you confirm that this "Watching... Using fs events" is what you'd expect to see with the vscode plugin?

joewiz added a commit to joewiz/existdb-langserver that referenced this issue Jun 29, 2020
@wolfgangmm
Copy link
Owner

@joewiz yes, the output appears to be right.

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

Successfully merging a pull request may close this issue.

2 participants