Skip to content
This repository was archived by the owner on Jul 30, 2024. It is now read-only.

Commit b84c9bd

Browse files
authored
Merge pull request #226 from exoego/node14-child-process
[child_process][cluster] Add serialization option
2 parents 9383d3c + cbf9c68 commit b84c9bd

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

app/current/src/main/scala/io/scalajs/nodejs/child_process/ForkOptions.scala

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,11 @@ import scala.scalajs.js.|
1212
* @param env Environment key-value pairs
1313
* @param execPath Executable used to create the child process
1414
* @param execArgv List of string arguments passed to the executable (Default: process.execArgv)
15+
* @param serialization
16+
* From Node.js v13.2.0, v12.16.0.
17+
* Specify the kind of serialization used for sending messages between processes.
18+
* Possible values are 'json' and 'advanced'. See Advanced Serialization for more details.
19+
* Default: 'json'.
1520
* @param silent If true, stdin, stdout, and stderr of the child will be piped to the parent,
1621
* otherwise they will be inherited from the parent, see the 'pipe' and 'inherit' options
1722
* for child_process.spawn()'s stdio for more details (Default: false)
@@ -26,6 +31,7 @@ class ForkOptions(var cwd: js.UndefOr[String] = js.undefined,
2631
var env: js.UndefOr[js.Object] = js.undefined,
2732
var execPath: js.UndefOr[String] = js.undefined,
2833
var execArgv: js.UndefOr[Array[String]] = js.undefined,
34+
var serialization: js.UndefOr[String] = js.undefined,
2935
var silent: js.UndefOr[Boolean] = js.undefined,
3036
var stdio: js.UndefOr[String | Array[String]] = js.undefined,
3137
var uid: js.UndefOr[UID] = js.undefined,

app/current/src/main/scala/io/scalajs/nodejs/cluster/ClusterSettings.scala

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,15 @@ trait ClusterSettings extends js.Object {
2323
/** <Boolean> whether or not to send output to parent's stdio. (Default=false) */
2424
var silent: Boolean = js.native
2525

26+
/**
27+
* Specify the kind of serialization used for sending messages between processes.
28+
* Possible values are 'json' and 'advanced'. See Advanced Serialization for more details.
29+
* Default: 'json'.
30+
*
31+
* From Node.js v13.2.0, v12.16.0.
32+
*/
33+
var serialization: String = js.native
34+
2635
/** <Number> Sets the user identity of the process. (See setuid(2).) */
2736
var uid: UID = js.native
2837

@@ -46,6 +55,7 @@ object ClusterSettings {
4655
exec: String = null,
4756
args: js.Array[String] = null,
4857
silent: Boolean = false,
58+
serialization: String = "json",
4959
stdio: js.Array[js.Any] = null,
5060
inspectPort: Int | js.Function = null,
5161
cwd: String = null,
@@ -56,6 +66,7 @@ object ClusterSettings {
5666
settings.updateDynamic("exec")(exec)
5767
settings.updateDynamic("args")(args)
5868
settings.updateDynamic("silent")(silent)
69+
settings.updateDynamic("serialization")(serialization)
5970
settings.updateDynamic("stdio")(stdio)
6071
settings.updateDynamic("inspectPort")(inspectPort.asInstanceOf[js.Any])
6172
settings.updateDynamic("cwd")(cwd)

0 commit comments

Comments
 (0)