Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1189)

Unified Diff: mmutex/cmd/mmutex/exclusive.go

Issue 2990863002: Implement the 'shared' subcommand for mmutex (Closed)
Patch Set: Created 3 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | mmutex/cmd/mmutex/exclusive_test.go » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mmutex/cmd/mmutex/exclusive.go
diff --git a/mmutex/cmd/mmutex/exclusive.go b/mmutex/cmd/mmutex/exclusive.go
index 00ff24d6e694ec1206be158578886e8c09df413e..dd799fb2d8f28516594de0bf15b32fe102e0bdc3 100644
--- a/mmutex/cmd/mmutex/exclusive.go
+++ b/mmutex/cmd/mmutex/exclusive.go
@@ -27,12 +27,12 @@ import (
)
var cmdExclusive = &subcommands.Command{
- UsageLine: "exclusive -- <command>",
+ UsageLine: "exclusive [options] -- <command>",
ShortDesc: "acquires an exclusive lock before running the command",
CommandRun: func() subcommands.CommandRun {
c := &cmdExclusiveRun{}
- c.Flags.DurationVar(&c.fslockTimeout, "fslock-timeout", 0, "Lock acquisition timeout")
- c.Flags.DurationVar(&c.fslockPollingInterval, "fslock-polling-interval", 0, "Lock acquisition polling interval")
+ c.Flags.DurationVar(&c.fslockTimeout, "fslock-timeout", 2*time.Hour, "Lock acquisition timeout")
+ c.Flags.DurationVar(&c.fslockPollingInterval, "fslock-polling-interval", 5*time.Second, "Lock acquisition polling interval")
return c
},
}
@@ -45,6 +45,11 @@ type cmdExclusiveRun struct {
func (c *cmdExclusiveRun) Run(a subcommands.Application, args []string, env subcommands.Env) int {
if err := RunExclusive(args, c.fslockTimeout, c.fslockPollingInterval); err != nil {
+ if exitErr, ok := err.(*exec.ExitError); ok {
+ return lib.GetExitCode(exitErr)
+ }
+
+ // We encountered an error that's unrelated to the command itself.
fmt.Fprintln(os.Stderr, err)
return 1
} else {
« no previous file with comments | « no previous file | mmutex/cmd/mmutex/exclusive_test.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698