Quotes are not being handled properly
Dawidpol opened this issue · 1 comments
Dawidpol commented
I am trying to copy a file after a build
new WebpackShellPluginNext({
onBuildExit: {
scripts: [
'cp "/path/to/src/index.js" "/path/to/dist/index.js"'
],
blocking: false,
parallel: true
}
})
When i run build it throws error /path/to/src/index.js: No such file or directory
but when i change the script to be without the qoutes:
cp /path/to/src/index.js /path/to/dist/index.js
Everything is working fine.
Is there a proper way to passing the qoutes to the command. I just need it in case there is a folder with space in the name
s00d commented
Good afternoon. You need function + execSync
import { execSync, exec } from 'child_process';
...
onBuildExit: {
scripts: [
() => new Promise((resolve, reject) => {
console.log('run async copy');
execSync('cp "/path/to/src/index.js" "/path/to/dist/index.js"') // or exec + callback
resolve();
}),
],
blocking: false,
parallel: true
},