-
-
Notifications
You must be signed in to change notification settings - Fork 217
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Log IPC messages with
verbose: 'full'
(#1063)
- Loading branch information
Showing
19 changed files
with
242 additions
and
48 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
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
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,18 @@ | ||
import {shouldLogIpc, logIpcMessage} from '../verbose/ipc.js'; | ||
import {loopOnMessages} from './get-each.js'; | ||
|
||
// Iterate through IPC messages sent by the subprocess | ||
export const waitForIpcMessages = async (subprocess, ipc, verboseInfo) => { | ||
if (!ipc || !shouldLogIpc(verboseInfo)) { | ||
return; | ||
} | ||
|
||
for await (const message of loopOnMessages({ | ||
anyProcess: subprocess, | ||
isSubprocess: false, | ||
ipc, | ||
shouldAwait: false, | ||
})) { | ||
logIpcMessage(message, verboseInfo); | ||
} | ||
}; |
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,8 @@ | ||
import {verboseLog, serializeLogMessage} from './log.js'; | ||
|
||
// When `verbose` is `'full'`, print IPC messages from the subprocess | ||
export const shouldLogIpc = ({verbose}) => verbose.at(-1) === 'full'; | ||
|
||
export const logIpcMessage = (message, {verboseId}) => { | ||
verboseLog(serializeLogMessage(message), verboseId, 'ipc'); | ||
}; |
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
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,7 @@ | ||
#!/usr/bin/env node | ||
import {sendMessage} from '../../index.js'; | ||
import {foobarString} from '../helpers/input.js'; | ||
|
||
await sendMessage(foobarString); | ||
|
||
setTimeout(() => {}, 1e8); |
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,6 @@ | ||
#!/usr/bin/env node | ||
import {argv} from 'node:process'; | ||
import {sendMessage} from '../../index.js'; | ||
|
||
const message = JSON.parse(argv[2]); | ||
await sendMessage(message); |
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 |
---|---|---|
@@ -1,5 +1,7 @@ | ||
#!/usr/bin/env node | ||
import {argv} from 'node:process'; | ||
import {sendMessage} from '../../index.js'; | ||
import {foobarString} from '../helpers/input.js'; | ||
|
||
await sendMessage(foobarString); | ||
const message = argv[2] || foobarString; | ||
await sendMessage(message); |
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
Oops, something went wrong.