Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Commits on Aug 1, 2014
  1. Collin Redding

    version to 2.3.1

    jcredding authored
    * Lock down posix-spawn version to 0.3.8 (c3206e6)
    
    /cc @kellyredding
  2. Collin Redding

    Lock down posix-spawn version to 0.3.8

    jcredding authored
    This locks down posix-spawn to version 0.3.8. The latest version
    (0.3.9) isn't compatible with ruby 1.8.7.
    
    /cc @kellyredding
Commits on Jul 31, 2014
  1. Kelly Redding

    version to 2.3.0

    kellyredding authored
    * reorg tests to breakout proper system tests #25
    * send stop/kill signals to *all* child processes #26
    * send specific signals to `kill` #27
    
    /cc @jcredding
  2. Kelly Redding

    Merge pull request #27 from redding/kr-kill-sig

    kellyredding authored
    send specific signals to `kill`
  3. Kelly Redding

    send specific signals to `kill`

    kellyredding authored
    This updates the `kill` method to task an optional signal name.  By
    default it sends the `'KILL'` signal.  This allows you to send a
    non-default signal to the command's pid and any child pids.
  4. Kelly Redding

    Merge pull request #26 from redding/kr-child-ips

    kellyredding authored
    send stop/kill signals to *all* child processes
  5. Kelly Redding

    send stop/kill signals to *all* child processes

    kellyredding authored
    This updates the stop/kill send signal logic to send the signal
    first to any child processes (recursively), then to the main command
    process.  This allows you to properly stop commands that spawn
    child processes.
    
    This came up when using Scmd to programmatically run `rackup`.  I
    found that stopping the command would indeed stop the main command
    but the spawned rackup process would not stop and my script would
    hang.
    
    Note, this uses `which pgrep` and the `pgrep` sys command to lookup
    the child processes.  If those don't return success with sane output,
    the command will act like it has no child processes and behave as
    before.  Note also that the those sys commands are run using scmd
    itself (so meta).  However, the way those commands are called will
    prevent any kind of infinite recursion problems (executed w/ `run`).
  6. Kelly Redding

    Merge pull request #25 from redding/kr-systests

    kellyredding authored
    reorg tests to breakout proper system tests
  7. Kelly Redding

    reorg tests to breakout proper system tests

    kellyredding authored
    There is not behavior changes here - just test reorgs.  This breaks
    out the command tests that are actually running commands into system
    tests.  This allows the unit tests to truly be unit tests.
Commits on Jul 30, 2014
  1. Kelly Redding

    update big data capture test to allow more time

    kellyredding authored
    This test was randomly failing b/c it would timeout.  This ups
    the allowed time to minimize the chance of a timeout happening.
    
    In this case it is ok b/c the timeout isn't being tested.  The
    streaming of a large amount of output is being tested.  We want
    to ensure there is enough time given to stream all that data.
    
    /cc @jcredding
Commits on Jun 13, 2014
  1. Collin Redding

    version to 2.2.0

    jcredding authored
    * Allow passing an env var hash to commands (#24)
    
    /cc @kellyredding
  2. Collin Redding

    Merge pull request #24 from redding/jcr-allow-passing-env-hash

    jcredding authored
    Allow passing an env var hash to commands
Commits on Jun 12, 2014
  1. Collin Redding

    Allow passing an env var hash to commands

    jcredding authored
    This updates the `Command` class to take a hash for passing env
    variables. These are passed to the `popen4` call and are set as
    environment variables for the child process. This allows passing
    sensitive env vars like passwords without putting them in the
    command string.
Commits on Mar 3, 2014
  1. Kelly Redding

    Merge pull request #23 from redding/kr-rbx

    kellyredding authored
    update to support Rubinius
Commits on Mar 2, 2014
  1. Kelly Redding

    update to support Rubinius

    kellyredding authored
    This adds the `rubysl` gem to the rbx platform.  It is needed to run
    the test suite on Rubinius.
Commits on Nov 11, 2013
  1. Kelly Redding

    version to 2.1.2

    kellyredding authored
    * some minor cleanups to the gem meta (4451e18)
    * some general cleanups and modernizations (#16)
    * have `RunError` *optionally* take a custom backtrace (#17)
    * read output from stdout and stderr while cmd is running (#18)
    * Add a bench mark script to help measure performance impact of changes (#20)
    * use a "self-pipe" to handle cmd timeouts (#21)
    * Some minor tweaks to the setup (#22)
    
    /cc @jcredding
  2. Kelly Redding

    Merge pull request #22 from redding/kr-setup-tweaks

    kellyredding authored
    Some minor tweaks to the setup
Commits on Nov 9, 2013
  1. Kelly Redding

    Some minor tweaks to the setup

    kellyredding authored
    This breaks resetting the attributes into its own method and makes
    the setup/teardown more about setting up or tearing down cmd runs.
    
    This is a slight improvement in code organization with no behavior
    changes.
Commits on Nov 8, 2013
  1. Kelly Redding

    Merge pull request #21 from redding/kr-self-pipe-timeout

    kellyredding authored
    use a "self-pipe" to handle cmd timeouts
Commits on Nov 7, 2013
  1. Kelly Redding

    use a "self-pipe" to handle cmd timeouts

    kellyredding authored
    This switches to defining a stop "self-pipe" for signaling when the
    child process has exited.  Intead of looping in the `wait_for_exit`
    and checking if you've timed out every `WAIT_INTERVAL`, you instead
    just select on the stop pipe with a timeout (or not).  The thread
    streaming the child process output also checks if the child process
    has exited.  If it has the stream thread writes to the stop pipe
    which triggers the wait to end.
  2. Kelly Redding

    Merge pull request #20 from redding/kr-bench

    kellyredding authored
    Add a bench mark script to help measure performance impact of changes
  3. Kelly Redding

    Add a bench mark script to help measure performance impact of changes

    kellyredding authored
    This add a bench mark script that measures running cmds multiple
    times and writes the results so we can know how a change impacts
    performance.
  4. Kelly Redding

    Merge pull request #18 from redding/kr-timeout-fix

    kellyredding authored
    read output from stdout and stderr while cmd is running
  5. Kelly Redding

    read output from stdout and stderr while cmd is running

    kellyredding authored
    This updates the cmd to begin reading from stdout and stderr as
    soon as the cmd has started running.  This is accomplished by
    starting a thread that reads `READ_SIZE` bytes from the io as long
    as the cmd is running.  Data is read using `read_nonblock` and new
    data is detected using `IO.select`.
    
    As before, calling `wait` if the cmd was started asynchronously
    is highly recommended (this either waits for the cmd to finish or
    times out).  Either way, this ensures the read output thread is
    exited and the exitstatus captured.  This is handled automatically
    if the cmd is started synchronously using `run`.
    
    The goal here is to prevent "deadlock" scenarios where a cmd can't
    finish b/c it has filled up one of the output streams.  It also
    enables output "streaming" as output will now be available for
    inspecting as soon as it is written.
    
    I've added some deadlock tests where I test both a `cat` cmd on both
    a small and big file.  The big file is larger than 64k (the default
    buffer size of stdout).  Both execute the cmd just fine without
    deadlocking and timing out on the `.wait(1)`.  This test fails without
    these changes.
    
    To accomplish this, I also remodeled the command's "run data" as a
    "child process" object.  This is a more appropriate name for the
    data and behavior this is encapsulating.  This allows the same
    access to the child process' data and allows us to abstract child
    process handling behavior in this object.
    
    Finally, this switches to _not_ stripping any read output.  This is
    necessary b/c we are now streaming output but also good b/c we want
    to preserve the output exactly as the cmd produced it.
Commits on Oct 16, 2013
  1. Kelly Redding

    Merge pull request #17 from redding/kr-run-error

    kellyredding authored
    have `RunError` *optionally* take a custom backtrace
  2. Kelly Redding

    have `RunError` *optionally* take a custom backtrace

    kellyredding authored
    This updates the RunError custom exception to be optionally created
    with a custom backtrace.  If none is provided, it falls back to the
    `caller`.  This makes it behave like any other exception class.
  3. Kelly Redding

    Merge pull request #16 from redding/kr-cleanups

    kellyredding authored
    some general cleanups and modernizations
  4. Kelly Redding

    some general cleanups and modernizations

    kellyredding authored
    * add `license` to gemspec
    * require latest assert
    * modernize tests
    
    No behavior changes - just cleanups.
Commits on Mar 29, 2013
  1. Kelly Redding
Commits on Mar 12, 2013
  1. Kelly Redding

    version to 2.1.1

    kellyredding authored
    * needed to kick rubygems so 2.1.x will install with bundler
    * b/c of a rubygems bug this morning
  2. Kelly Redding

    version to 2.1.0

    kellyredding authored
    * some updates and cleanups to the gem lib (#10)
    * reworked pid status gathering using `waitpid2` (#11)
    * Run cmds asynchronously: start, wait, stop, kill (#12)
  3. Kelly Redding

    Merge pull request #12 from redding/kr-startstop

    kellyredding authored
    Run cmds asynchronously: start, wait, stop, kill
Commits on Mar 11, 2013
  1. Kelly Redding

    Run cmds asynchronously: start, wait, stop, kill

    kellyredding authored
    This adds an API for running cmds and explicitly waiting for them
    to exit.
    
    This updates the original `run` implementation to just be a macro
    to `start` then `wait`.
    
    Closes #9.
Commits on Mar 8, 2013
  1. Kelly Redding

    wrap all spawn attrs into a single RunData object

    kellyredding authored
    This is so you don't need to track state of each attr individually.
  2. Kelly Redding

    Merge pull request #11 from redding/kr-waitpid2

    kellyredding authored
    reworked pid status gathering using `waitpid2`
Something went wrong with that request. Please try again.