Skip to content

Add Timer & kill #2

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

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open

Add Timer & kill #2

wants to merge 4 commits into from

Conversation

olekukonko
Copy link

Implemented time and kill, due to name conflict on windows i named it timer

  • timer (same as time on unix to time how load a proves takes
    eg. timer curl http://google.com
    C:\tmp>timer curl google.com
    <HTML><HEAD><meta http-equiv="content-type" content="text/html;charset=utf-8">
    <TITLE>301 Moved</TITLE></HEAD><BODY>
    <H1>301 Moved</H1>
    The document has moved
    <A HREF="http://www.google.com/">here</A>.
    </BODY></HTML>

    Time:  1.223s
  • kill - simple way to kill system process based on taskkill (I can send a pull request on this if you want)
    eg.
    kill firefox 
    kill notepad chrome taskmgr

@laher
Copy link
Owner

laher commented Mar 4, 2014

Hi Oleku, thanks very much for your efforts

  • Good news: the time/timer util is good stuff (just needs some tweaking to make it cross-platform).
  • Bad news: sorry but the kill util is not applicable for 3 reasons: 1) it's not cross-platform (Windows only), 2) it doesn't behave like the linux 'kill' command - it's more like 'killall', and 3) I don't want to go down the road of wrapping existing commands - not just yet anyway.
    It's not where I'm going with this project. If you have the stomach to make it cross-platform (Linux/Win/Mac at least), then it's certainly a worthwhile tool, but otherwise it's best to keep it separate for now.

So, if you were open to submitting a separate pull request with just the time command, and without the 'cmd /c' part, then we'd be in business (with some caveats: I'll still call it 'time' for consistency - Windows users would need to call 'some time', and I'll change the import paths to my repo). Sorry but I need to keep things consistent.

All good?
Cheers

@olekukonko
Copy link
Author

Good news: the time/timer util is good stuff (just needs some tweaking to make it cross-platform).

I would see what i can do ... just be travail making it cross platform

it's not cross-platform (Windows only)

We can achieve the same function with pgrep + syscall.Kill on posix platforms

it doesn't behave like the linux 'kill' command - it's more like 'killall',

you are right if multiple process has the same name it would kill all the process

don't want to go down the road of wrapping existing commands - not just yet anyway. It's not where I'm going with this project.

Noted

without the cmd /c

There is no other way that i know off that works on windows

@laher
Copy link
Owner

laher commented Mar 4, 2014

Maybe 'wrapped' commands should belong inside 'otherutils' - I guess there
won't be any other way to do a 'kill' on Windows for the moment.
For info, 'kill' in unix takes a process id. So, you'd use 'ps' or similar
to find the process id, and then subsequently kill . Kill is also used
to send other signals to a process, I don't know if there's an equivalent
in windows. Also, aswell as pgrep you also have pkill. It would be nice to
have cross-platform implementations of each of these... wrapping taskkill
is probably the only way for Windows, so it's a good solution. Wrapping ps
might be the best for Unix (pgrep isn't always installed). So, it's all a
bit murky I'm afraid. I'm hoping to catch some more low-hanging fruit
before spending time on it myself.
Thanks again though.
By the way, diff-go looks great. Diff & patch are fundamental tools and I
was dreading trying to code them from scratch, so it's probably the best
choice to use something like diff-go to achieve them.
Cheers

On Tue, Mar 4, 2014 at 9:52 PM, Oleku Konko [email protected]:

Good news: the time/timer util is good stuff (just needs some tweaking to
make it cross-platform).

I would see what i can do ... just be travail making it cross platform

it's not cross-platform (Windows only)

We can achieve the same function with pgrep + syscall.Kill on posix
platforms

it doesn't behave like the linux 'kill' command - it's more like 'killall',

you are right if multiple process has the same name it would kill all the
process

don't want to go down the road of wrapping existing commands - not just
yet anyway. It's not where I'm going with this project.

Noted

Reply to this email directly or view it on GitHubhttps://github.com//pull/2#issuecomment-36603525
.

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

Successfully merging this pull request may close these issues.

2 participants