Skip to content
This repository has been archived by the owner on May 23, 2022. It is now read-only.

Windows support #16

Closed
wants to merge 1 commit into from
Closed

Conversation

leonardiwagner
Copy link

Hi, this resolves #15

I tested on Windows 8.1 (both cmd.exe and powershell.exe) and worked fine...even killing multiple process (such as chrome), I also tested on Linux Debian 8 and was doing great too after changes.

I tried to not be intrusive changing a lot of code right now 😄 , so I only included an "if" to check OS, but if you think that's OK, I can open another issue to work on mac/osx too.. however it would change a lot of code (and maybe your time, because I'm not too familiar with this Haskell/functional coding style!), Thanks!

var killFunction;

if(os.platform().indexOf('win') !== -1){
processes = shell('for /f "tokens=2 delims=," %F in (\'tasklist /nh /fi "imagename eq ' + (processName.indexOf('.') === -1 ? processName + '.exe' : processName) + '" /fo csv\') do @echo %~F', []);
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably too long, but I can't ask Windows just a list of pids! So this single-line command will both ask for process list and translate into pgrep style.. without messing the remaining code just for Windows sake!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Fuck you windows
1 participant