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

Congratulations and question about Windows cmd #89

Closed
frederikhors opened this issue Dec 19, 2020 · 5 comments
Closed

Congratulations and question about Windows cmd #89

frederikhors opened this issue Dec 19, 2020 · 5 comments
Assignees
Labels
bug dependencies Pull requests that update a dependency file

Comments

@frederikhors
Copy link

Using your amazing pkg on Windows 10 with the below code is opening my cmd, why?

image

function tryMe() {
  const compress = Seven.add("myfolder", "myfolder")
}
@jmopel
Copy link
Contributor

jmopel commented Dec 19, 2020

Try to use 7zip-bin module as $bin option. Everything will happen in the background.

npm i 7zip-bin
const Seven = require('node-7z')
const sevenBin = require('7zip-bin')

const pathTo7zip = sevenBin.path7za

function tryMe() {
  const compress = Seven.add("myfolder", "myfolder", {
	  $bin: pathTo7zip
  })
}

@q2s2t
Copy link
Owner

q2s2t commented Dec 27, 2020

Thanks !

The package works by spawning an actual 7zip command based on your input, the parse the output (stdout) and send the appropriate JS events.

So what you see is "normal"

Unfortunatly I'm a little bit unclear on the implementation of the Spawn command on Windows (linux user here 😁) and I don't know why it's not happening in the background by default.

I will run more tests in the next few weeks.

@q2s2t
Copy link
Owner

q2s2t commented Jan 3, 2021

If you don't need the process to be detached you can do:

function tryMe() {
  const compress = Seven.add("myfolder", "myfolder", { $spawnOptions: { detached: false } } )
}

An alternative is the windowsHide option. But due to what seems to be an upstream bug it doesn't at the moment. moxystudio/node-cross-spawn#143

function tryMe() {
  const compress = Seven.add("myfolder", "myfolder", { $spawnOptions: { windowsHide: true } } )
}

@q2s2t q2s2t added bug dependencies Pull requests that update a dependency file and removed enhancement question labels Jan 3, 2021
@q2s2t
Copy link
Owner

q2s2t commented Jan 3, 2021

Note to myself : consider adding windowsHide as a default on the next version

q2s2t pushed a commit that referenced this issue Jul 11, 2021
BREAKING CHANGE: Drop cross-spawn in favor of Node.js spawn
@q2s2t
Copy link
Owner

q2s2t commented Jul 11, 2021

Fixed on the next release

@q2s2t q2s2t closed this as completed Jul 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug dependencies Pull requests that update a dependency file
Projects
None yet
Development

No branches or pull requests

3 participants