47 Commits
Author SHA1 Message Date
Tom AndersonandDavid Dollar 9cd7400514 Expand the help text for the start command, and give a hint on where to find it (#98) (#99) 2017-03-27 15:54:21 -04:00
Daniel PerezandDavid Dollar 9bebfece50 Add flag to customize shutdown gracetime (#84) 2016-06-05 20:22:49 -04:00
codeskyblueandDavid Dollar 7d31007cd6 catch more signals instead of just sigint 2016-04-13 13:13:10 -07:00
Võ Anh DuyandDavid Dollar dd6e9899ca Allow local config with .forego (#56)
See #32
gotenv can read simple yaml file so we don't need to use a read yaml
parse.
The value in forego file will be set as default value, if we set flag
or env value, it will override the value in forego file
2016-04-13 13:11:00 -07:00
Joshua MervineandDavid Dollar ea0c5b42d0 start concurrency only runs listed processes (#64)
* start concurrency only runs listed processes

* fixing all condition in a hacky way
2016-04-13 13:07:12 -07:00
Nicolas GrillyandDavid Dollar 9c1bbd7d26 Simplify Forego.startProcess (#79)
* Remove unnecessary return

* Simplify method Forego.startProcess

We need to call f.teardown.Fall() only when a process has finished
and restart is disabled.

When f.teardown.Barrier() is closed, it’s unnecessary to call
f.teardown.Fall() because we know the barrier is already closed.

* Don’t wait twice on finished

The select has two cases. In the first case, we wait on finished.
We don’t need to wait on finished a second time since we already know
that finished is closed. This is the reason why we moved the defer statement
at the beginning of the second case.

* This goroutine doesn’t need to block until the process has finished
2016-04-13 13:05:13 -07:00
Nicolas Grilly 9372bb8def Fix restart 2016-03-21 13:09:44 +01:00
Nicolás Hock Isaza 76b295e7f5 Read PORT from the environment
Read the `PORT` from the system environment if it's present. This is
related to #44 and will make the port read order this:

1. `-p` flag.
2. `PORT` in the `.env` file
3. `PORT` environment variable
4. 5000 as default port
2015-01-02 16:53:13 -05:00
Sergio BoteroandDavid Dollar bff4e8f8cf Read port from env
Allow the port to be set on the .env file to avoid using the port flag
every time.
2015-01-01 21:20:18 -05:00
Nicolás Hock Isaza 294ed6c9ec Support multiple environment files on forego run 2014-12-22 19:41:47 -05:00
Nicolás Hock Isaza 656dbf434d Move loading multiple environments to env.go
This way all the env related code is in the same place.
2014-12-22 19:30:02 -05:00
Nicolás Hock Isaza e5004cd349 Support multiple environment flags
This adds support for multiple environment files via multiple `-e`
flags.

Closes #13
2014-12-21 11:28:18 -05:00
David Dollar 90b3a377b0 allow default concurrency 2014-08-12 18:37:34 -04:00
David Dollar 73521422be better error message for concurrency 2014-06-19 18:57:55 -04:00
Peter Waller fff52bfbba Check ps.Start() error
This doesn't usually happen unless the shell is broken or unavailable.

It's nice though to have a program which shows an error message rather
than quitting silently. The test to see if this is working is to modify
the shell in `unix.go` to something which doesn't exist.
2014-06-02 19:35:13 +01:00
David Dollar 26261f844e Merge pull request #26 from pwaller/fix-len
Fix LongestProcessName
2014-06-02 11:14:43 -07:00
Peter Waller 37aac8a97e Refactor to use Barrier 2014-05-22 17:42:48 +01:00
Peter Waller 34b39bf589 Fix #16 and race condition on final lines printed
This commit refactors to read whole lines from Stdin/Stdout pipes and
fixes a race condition where the final output of a process may be
missed.
2014-05-21 20:26:56 +01:00
Peter Waller c165325ed1 Embed *exec.Cmd in Process struct
Motivation: Trying to slim the Process wrapper as much as possible to
make later transformations easier.
2014-05-21 19:49:12 +01:00
Peter Waller f2170857e6 Move 'shutting down' msg to before close(teardown) 2014-05-21 09:41:37 +01:00
Peter Waller 1bc3decf0c Implement teardownNow with Kill on 2nd CTRL-C 2014-05-21 09:35:15 +01:00
Peter Waller a5074c5c37 Refactor process shutdown
This is a large change which makes startProcess() responsible for
shutting its own process down, rather than having a global map.

This makes it much easier to reason about who owns what and get the
synchronization right.

The main immediate bugfix is that now we only attempt to send SIGKILL to
processes which haven't yet shut down, making it clearer which processes
are responsible for a delayed shutdown.

It introduces a `teardown` channel which is closed to signal to all
process-monitoring goroutines that they should clean up.

In addition, the platform-specific code has been thinned. Some of the
platform logic moved into the process-monitoring code because it needed
to for now after the introduction of the <-finished barrier.
2014-05-21 09:28:41 +01:00
Peter Waller ca11ca6388 Refactor ShutdownProcess to smaller platform-specific part 2014-05-21 08:44:06 +01:00
Peter Waller 9c2bf670ca Refactor interrupt monitoring and shutdown
This makes it so that the same goroutine responsible for starting
processes shuts them down. This is a stepping stone to a larger refactor
whose goal is to eliminate race conditions.
2014-05-21 08:37:21 +01:00
Peter Waller c3001f4941 Use defer to unlock mutex
This is safer in general, in case a function exits for any reason,
including due to a panic (which may be recovered later).
2014-05-21 08:02:40 +01:00
Peter Waller eb103b5843 Use defer to mark goroutine completed
Also, move the wg.Add() next to the point where it matters.
2014-05-21 08:00:38 +01:00
Peter Waller 9fd558a9cc Simplify procName calculation 2014-05-21 07:59:38 +01:00
Peter Waller 7d87c01493 Fix LongestProcessName 2014-05-21 07:36:21 +01:00
Jason Wilder 42b0dcaf43 Add restart option
If a child process dies, forego shuts down all processes.  The -r
option will restart the failed child process.
2014-05-12 17:14:47 -06:00
Jason Wilder 16b7228a81 Add concurrency support
For #18
2014-05-07 15:01:39 -06:00
David Pelaez 495a0557d1 Fix bug calculating a group's port
In the original foreman, an increase of 100 defined the number of the first process of the next group, hence, a two type Procfile uses ports 5000 and 5100. Forego was correctly printing this expected numbers but line 86 was recalculating this port number again with a distance of 1000 not a hundred. The result was that I was seeing my second type of process listening on port 6000, not the expected 5100.
2014-04-28 21:43:01 -05:00
David Dollar 0b6b2c63b6 fail more gracefully if a process fails to start, fixes #10 2013-09-17 16:49:37 -04:00
David Dollar ceaf98ab88 start porting 2013-08-29 18:36:16 -04:00
David Dollar 3c354f14f3 refactor and cleanup 2013-08-29 14:57:35 -04:00
David Dollar f32684375a go fmt 2013-08-27 16:51:24 -04:00
David Dollar f85df22d56 fix name padding 2013-08-26 21:58:16 -04:00
David Dollar 9bc2feb74b support .profile scripts 2013-08-26 17:00:48 -04:00
David Dollar a3132999c8 work with singleton processes 2013-08-26 16:50:21 -04:00
David Dollar 8e6a712e31 add run 2013-08-26 14:44:26 -04:00
David Dollar 437417bc48 avoid race 2013-08-26 14:22:21 -04:00
David Dollar 27c6d66580 signal management, system messages 2013-08-25 16:53:21 -07:00
David Dollar e524d0e200 wip 2013-08-25 16:11:16 -07:00
David Dollar 3bda42c344 inherit surrounding env 2013-08-24 11:23:51 -07:00
David Dollar 87886cdb6e updates 2013-08-24 11:11:28 -07:00
David Dollar 5afcfc2f95 update with suggestions from @kr 2013-08-22 12:35:51 -07:00
David Dollar 1c08447721 help cleanup 2013-08-21 15:01:54 -04:00
David Dollar 4a3f622c51 stole command framework from hk, stubbed start command 2013-08-21 14:53:15 -04:00