-
Notifications
You must be signed in to change notification settings - Fork 71
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update azure-aci to use nodeutil instead of node-cli
Signed-off-by: Heba Elayoty <hebaelayoty@gmail.com>
- Loading branch information
Showing
31 changed files
with
790 additions
and
381 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
/* | ||
Copyright (c) Microsoft Corporation. | ||
Licensed under the Apache 2.0 license. | ||
*/ | ||
package main | ||
|
||
import ( | ||
"context" | ||
"os" | ||
"os/signal" | ||
) | ||
|
||
func BaseContext(ctx context.Context) (context.Context, func()) { | ||
sigC := make(chan os.Signal, 1) | ||
ctx, cancel := context.WithCancel(ctx) | ||
|
||
go func() { | ||
for { | ||
select { | ||
case <-ctx.Done(): | ||
signal.Stop(sigC) | ||
return | ||
case <-sigC: | ||
cancel() | ||
} | ||
} | ||
}() | ||
|
||
signal.Notify(sigC, cancelSigs()...) | ||
return ctx, cancel | ||
} |
Oops, something went wrong.