schell / steeloverseer

A file watcher and development tool.
BSD 3-Clause "New" or "Revised" License
128 stars 15 forks source link

Better interactive command management #21

Closed mitchellwrosen closed 7 years ago

mitchellwrosen commented 7 years ago

Fixes #20

Now, jobs are run in their own process group, which is sent SIGTERM when the job ends or is terminated. This is a simple effort to kill any non-daemon child processes spawned by the job during its run.

The launched job now needs to be given terminal control so it can read input, which is restored on completion to sos. Also, stdin is flushed before running a job, in case the user happened to type some stuff into the terminal on accident (which is never read by sos).

mitchellwrosen commented 7 years ago

As an example motivation for this change, I'm able to now use this .sosrc file when developing a rust project:

- pattern: ^src/.*\.rs$
  commands:
    - cargo build
    - cargo run

which previously would not kill the running binary between file saves (cargo run forks). Yay!

schell commented 7 years ago

This looks great and I admit this problem has happened to me as well. Looks like the travis.yaml will need an update as well since it's now building with out of date snapshots (I can do this later).