Git Product home page Git Product logo

Comments (7)

jarib avatar jarib commented on July 19, 2024

Please include the code you're using to run PowerShell and CMD through ChildProcess.

from childprocess.

Sauraus avatar Sauraus commented on July 19, 2024

https://gist.github.com/Sauraus/c3e85a766415eb10daf0

from childprocess.

jarib avatar jarib commented on July 19, 2024

Can you reproduce the problem without the Vagrant wrapper? What do you mean by "does not die" - do you see powershell.exe in the machine's process list?

ChildProcess is not executing the command in a shell, it is executing powershell.exe directly through the CreateProcess system call. You're passing [";", "exit", "$LASTEXITCODE"] as arguments to powershell.exe. Is that the intention?

I don't have a windows machine to try this on at the moment, but if you want anything interpreted as in cmd.exe, you'll have to invoke the interpreter yourself, e.g. something like:

process = ChildProcess.build("cmd.exe", "/c", "powershell Expand-Archive ...")
process.start

from childprocess.

Sauraus avatar Sauraus commented on July 19, 2024

Correct powershell.exe remains running as a child process long after the Expand-Archive has finished, which I can see in process explorer.

I tried the ;exit $LASTEXITCODE for force the powershell.exe process to terminate after running the command Expand-Archive.

PowerShell has the equivalent of cmd.exe /c being PowerShell.exe -Command but even if I use that something in the way how ChildProcess spawns powershell keeps it from exiting when done.

from childprocess.

jarib avatar jarib commented on July 19, 2024

I very much doubt the problem is ChildProcess. Have you tried passing the -NonInteractive flag to PowerShell (from http://technet.microsoft.com/en-us/library/hh847736.aspx)?

from childprocess.

jarib avatar jarib commented on July 19, 2024

Also, your gist does not use -Command flag. You should try that:

ChildProcess.build("PowerShell.exe", "-Command", "the full command in a string")

from childprocess.

jarib avatar jarib commented on July 19, 2024

Going to close this since there's no response in a month.

from childprocess.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.