-
Notifications
You must be signed in to change notification settings - Fork 7
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
Executing batch command (cmd or bat) in windows fails #5
Comments
@raleksandar thanks for this. Can you tell me which version of multiview you're using? Is it installed via npm? I'm honestly not too familiar with yarn so might need a bit of help understanding the underlying mechanisms yarn employs when invoking npm installed cli programs and in that context how they invoke yarn scripts :) Multiview should technically take the commands and spawn them but depending on how yarn is invoked globally vs locally it may fail. In your yarn config can you try a few things: What happens if you call these directly from the command line? I'll try testing on my local environment too (macOS). |
Hi @arjunmehta, thanks for quick reply :) I forgot to mention version of multiview I'm using, sorry, it's v2.5.1. I have been running it from local node_modules dir (i.e. didn't have multiview installed globally). But I have tried:
And they all fail to run command (they give exit code 1 instead). I have also verified running multiview (both local and global) without having yarn involved and both of these work:
|
Closed this accidentally :) |
I have just tried using I've changed package.json to have following in scripts filed: "testmv1": "multiview [npm run lsla]",
"testmv2": "multiview [ls -la]",
"lsla": "ls -la" And running So.. not sure what exactly is the problem :) |
@raleksandar It seems to be working alright on macOS. {
"name": "yarnTest",
"version": "1.0.0",
"main": "index.js",
"license": "MIT",
"scripts": {
"lsla": "ls -la",
"mv": "multiview [yarn lsla] [yarn lsla] -x 2000"
},
"dependencies": {
"multiview": "^2.5.1"
}
} Running So, this may be windows specific, and may have something to do with how node executes npm "binaries" on windows. Will look into it some more, but this will be difficult for me to test! :( |
I believe I've "fixed" it. Well, made it run I have added var spawnedProcess = spawn(command, args, {
shell: 'cmd.exe'
}); I'll test a bit more and if it's ok with you I could create a PR which would set shell option to cmd.exe if running on windows? |
Yes please contribute a fix! Can you also test with npm in addition to yarn? I was going to point you to this: nodejs/node#3675 Definitely something to do with |
Tested with both yarn and npm, also ran couple of other Node.js binaries (webpack, gulp) via multiview. Everything works :) |
Nice! I reviewed your PR. Looks excellent, but I have a few code style nits before we merge. |
@raleksandar Thank you for your help! |
I'm trying to use multiview with yarn and I want to have this in my
"scripts"
section ofpackage.json
:But after the
build:dev
scripts finishes (just runs webpack with dev config) multiview starts and displays<command> (done)
andExited with code 1
for each command without ever running them.I have confirmed that this is not due to webpack or nodemon (which are used in my watch and run:* tasks) by having this in my
"scripts"
section:Running
yarn testmv1
shows same behavior as my config (i.e. thelsla
script is not executed by multiview and it reports exit code 1) while runningyarn testmv2
executesls -la
and displays its output correctly.I have tested this on Windows 10 (x64, latest insider fast build) with Node v7.8.0 and Yarn v0.22.0 (which is current RC, tried first with latest stable v0.21.3 but it's the same behavior with both versions).
The text was updated successfully, but these errors were encountered: