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

How do you close a program once you've opened it? #152

Open
doverradio opened this issue Sep 26, 2019 · 7 comments
Open

How do you close a program once you've opened it? #152

doverradio opened this issue Sep 26, 2019 · 7 comments

Comments

@doverradio
Copy link

doverradio commented Sep 26, 2019

Hello, I was able to successfully open up a program using your library in Windows 10. Here is the code:

const open = require('open');
 
// Opens the program WordPerfect in the default image viewer
(async () => {
    await open('C:\\Program Files (x86)\\Corel\\WordPerfect Office X4\\Programs\\wpwin14.exe', {wait: true});
    console.log('Did WordPerfect open?');
 
})();

However, it's not clear how to close this once I've completed the tasks I need within that opened program.

How do I close this after I've completed using the opened program?

@hong4rc
Copy link
Contributor

hong4rc commented Jan 2, 2020

open give you a sub process, you can call it to kill itself. Unfortunately, that sub process create another process, which should be killed.

@sindresorhus Do you think that it is possible to resolve with sub process of start command(on window)?

@ryanesch
Copy link

@hongarc can you give an example?

@hong4rc
Copy link
Contributor

hong4rc commented Feb 28, 2020

The main process create a new process (A)

A process creates another process(B, the application you want here)

You can close A process but I don't know how to close B process
(you can add argument for B process but to get it)

@einarpersson
Copy link

Any ideas? Facing the same issue here

@wgottschalk
Copy link

wgottschalk commented Mar 19, 2020

also curious about this. I would love to open a chrome tab and then close it when my program (static file server) exits.

@ZzqiZQute
Copy link

Is there any solution? Got stuck here too!

@Lunchb0ne
Copy link

Lunchb0ne commented Jun 17, 2020

Yeap, same problem here!

EDIT: So I tried calling kill on the item it returns, via tree-kill, but still doesn't work

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

No branches or pull requests

7 participants