Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

1.0.60 preview7 patch #167

Merged
merged 3 commits into from
Aug 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions .husky/post-push
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

## husky task runner examples -------------------
## Note : for local installation use 'dotnet' prefix. e.g. 'dotnet husky'

## run all tasks
#husky run

### run all tasks with group: 'group-name'
#husky run --group group-name

## run task with name: 'task-name'
#husky run --name task-name

## pass hook arguments to task
#husky run --args "$1" "$2"

## or put your custom commands -------------------
#echo 'Husky.Net is awesome!'

dotnet husky run --group post-push
20 changes: 10 additions & 10 deletions .husky/task-runner.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,7 @@
"group": "commit-msg",
"command": "dotnet-exec",
"args": [".husky/scripts/commit-lint.cs", "--args", "${args}"]
},
{
"name": "dotnet-format",
"group": "pre-push",
"command": "dotnet",
"args": [ "format" ],
"include": [
"**/*.cs"
]
},
},
{
"name": "test",
"group": "pre-push",
Expand All @@ -25,6 +16,15 @@
"**/*.md",
"docs/**/*"
]
},
{
"name": "dotnet-format",
"group": "post-push",
"command": "dotnet",
"args": [ "format" ],
"include": [
"**/*.cs"
]
}
]
}
2 changes: 1 addition & 1 deletion src/WeihanLi.Common/Helpers/InvokeHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ private static void InvokeExitHandler(object? sender, EventArgs? args)
Debug.WriteLine("exiting...");
if (LazyCancellationTokenSource.IsValueCreated)
{
LazyCancellationTokenSource.Value.Cancel();
LazyCancellationTokenSource.Value.Cancel(false);
LazyCancellationTokenSource.Value.Dispose();
}
Debug.WriteLine("exited");
Expand Down
2 changes: 1 addition & 1 deletion src/WeihanLi.Common/Helpers/PipelineBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public static IValueAsyncPipelineBuilder<TContext> CreateValueAsync<TContext>()
#if NET6_0_OR_GREATER
ValueTask.CompletedTask
#else
TaskHelper.CompletedValueTask
default(ValueTask)
#endif
);
}
Expand Down
20 changes: 7 additions & 13 deletions src/WeihanLi.Common/Helpers/TaskHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,25 +5,19 @@ namespace WeihanLi.Common.Helpers;

public static class TaskHelper
{
#if ValueTaskSupport
/// <summary>
/// A cached completed value task
/// </summary>
public static ValueTask CompletedValueTask =>
#if NET6_0_OR_GREATER
ValueTask.CompletedTask
#else
default
#endif
;

#if ValueTaskSupport
public static ValueTask ToTask(object? obj)
{
var task = obj switch
{
ValueTask vt => vt,
Task t => new ValueTask(t),
_ => CompletedValueTask
_ =>
#if NET6_0_OR_GREATER
ValueTask.CompletedTask
#else
default
#endif
};
return task;
}
Expand Down
2 changes: 1 addition & 1 deletion src/WeihanLi.Common/NullDisposable.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public ValueTask DisposeAsync() =>
#if NET6_0_OR_GREATER
ValueTask.CompletedTask
#else
TaskHelper.CompletedValueTask
default(ValueTask)
#endif
;
#endif
Expand Down