-
Notifications
You must be signed in to change notification settings - Fork 3
process logging middleware #195
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
Merged
Merged
Changes from all commits
Commits
Show all changes
28 commits
Select commit
Hold shift + click to select a range
d74c6e9
spike out process logging middleware
jbolda 6c018bc
switch to scope eval instead of resource
jbolda 9e9bec7
fmt
jbolda 4341d67
reorder TS refs to fix build order
jbolda 4f929ac
process tsconfig
jbolda 5088fc9
context-api in process/tsconfig
jbolda 24d0856
remove context change
jbolda c634ca8
bump package to 0.8.0
jbolda cafeae6
trim io test
jbolda 05dcbd5
trim other io test
jbolda 38880a3
write bytes, string once
jbolda 0cc65de
byte the bullet
jbolda 48886cd
stderr to stderr
jbolda 2892e44
rename api and type names
jbolda 65ec51d
save stderr separate from stdout
jbolda ddf3974
Fix stderr middleware bug and flaky io api tests (#205)
taras 02da077
treekill on null exitCode
jbolda 0fcb970
readme example fix
jbolda da2b499
jsdocs
jbolda 341799e
Merge branch 'main' into process-logging-middleware
jbolda cf59625
type import tweaks
jbolda 22aaedc
remove context api change
jbolda 1645afb
evalScope around in win32
jbolda 49ac4f7
move win32 shutdown stdio wait
jbolda 0288c05
wait on stdio to close before taskkill
jbolda 5b889fb
export operations
jbolda 95a99f1
Merge branch 'main' into process-logging-middleware
jbolda 47be6bc
Revert "export operations"
jbolda File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or 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 hidden or 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 |
|---|---|---|
| @@ -1,2 +1,3 @@ | ||
| export * from "./src/exec.ts"; | ||
| export { type Daemon, daemon } from "./src/daemon.ts"; | ||
| export * from "./src/api.ts"; |
This file contains hidden or 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 hidden or 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,48 @@ | ||
| import { createApi } from "@effectionx/context-api"; | ||
| import type { StdioApi } from "./exec/types.ts"; | ||
|
|
||
| /** | ||
| * Context API used to observe or customize process stdio handling. | ||
| * | ||
| * By default, `stdout` and `stderr` are written directly to the host process | ||
| * streams. Middleware can wrap this API via `Stdio.around(...)` to capture, | ||
| * transform, or redirect child process output. | ||
| * | ||
| * @example | ||
| * ```ts | ||
| * import { main } from "effection"; | ||
| * import { Stdio, exec } from "@effectionx/process"; | ||
| * | ||
| * await main(function* () { | ||
| * let outputStdout: Uint8Array[] = []; | ||
| * let outputStderr: Uint8Array[] = []; | ||
| * | ||
| * // affects child processes in this scope | ||
| * // and all child scopes unless overridden | ||
| * yield* Stdio.around({ | ||
| * *stdout(line, next) { | ||
| * const [bytes] = line; | ||
| * outputStdout.push(bytes); | ||
| * return yield* next(line); | ||
| * }, | ||
| * *stderr(line, next) { | ||
| * const [bytes] = line; | ||
| * outputStderr.push(bytes); | ||
| * return yield* next(line); | ||
| * }, | ||
| * }); | ||
| * | ||
| * yield* exec("node ./fixtures/hello-world.js", { | ||
| * cwd: import.meta.dirname, | ||
| * }).expect(); | ||
| * }); | ||
| * ``` | ||
| */ | ||
| export const Stdio = createApi<StdioApi>("process:io", { | ||
| *stdout(line) { | ||
| process.stdout.write(line); | ||
| }, | ||
| *stderr(line) { | ||
| process.stderr.write(line); | ||
| }, | ||
| }); |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.