Skip to content

Commit 9c15124

Browse files
vdeturckheimtargos
authored andcommitted
vm: clarify timeout option in vm
This updates the documentation to clarify how to use `timeout` in the vm module. PR-URL: #23512 Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
1 parent 8642eac commit 9c15124

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

doc/api/vm.md

+14-14
Original file line numberDiff line numberDiff line change
@@ -246,9 +246,9 @@ in the ECMAScript specification.
246246
### module.evaluate([options])
247247

248248
* `options` {Object}
249-
* `timeout` {number} Specifies the number of milliseconds to evaluate
249+
* `timeout` {integer} Specifies the number of milliseconds to evaluate
250250
before terminating execution. If execution is interrupted, an [`Error`][]
251-
will be thrown.
251+
will be thrown. This value must be a strictly positive integer.
252252
* `breakOnSigint` {boolean} If `true`, the execution will be terminated when
253253
`SIGINT` (Ctrl+C) is received. Existing handlers for the event that have
254254
been attached via `process.on('SIGINT')` will be disabled during script
@@ -507,9 +507,9 @@ changes:
507507
* `displayErrors` {boolean} When `true`, if an [`Error`][] error occurs
508508
while compiling the `code`, the line of code causing the error is attached
509509
to the stack trace.
510-
* `timeout` {number} Specifies the number of milliseconds to execute `code`
510+
* `timeout` {integer} Specifies the number of milliseconds to execute `code`
511511
before terminating execution. If execution is terminated, an [`Error`][]
512-
will be thrown.
512+
will be thrown. This value must be a strictly positive integer.
513513
* `breakOnSigint`: if `true`, the execution will be terminated when
514514
`SIGINT` (Ctrl+C) is received. Existing handlers for the
515515
event that have been attached via `process.on('SIGINT')` will be disabled
@@ -570,9 +570,9 @@ changes:
570570
* `displayErrors` {boolean} When `true`, if an [`Error`][] error occurs
571571
while compiling the `code`, the line of code causing the error is attached
572572
to the stack trace.
573-
* `timeout` {number} Specifies the number of milliseconds to execute `code`
573+
* `timeout` {integer} Specifies the number of milliseconds to execute `code`
574574
before terminating execution. If execution is terminated, an [`Error`][]
575-
will be thrown.
575+
will be thrown. This value must be a strictly positive integer.
576576
* `contextName` {string} Human-readable name of the newly created context.
577577
**Default:** `'VM Context i'`, where `i` is an ascending numerical index of
578578
the created context.
@@ -628,9 +628,9 @@ added: v0.3.1
628628
* `displayErrors` {boolean} When `true`, if an [`Error`][] error occurs
629629
while compiling the `code`, the line of code causing the error is attached
630630
to the stack trace.
631-
* `timeout` {number} Specifies the number of milliseconds to execute `code`
631+
* `timeout` {integer} Specifies the number of milliseconds to execute `code`
632632
before terminating execution. If execution is terminated, an [`Error`][]
633-
will be thrown.
633+
will be thrown. This value must be a strictly positive integer.
634634

635635
Runs the compiled code contained by the `vm.Script` within the context of the
636636
current `global` object. Running code does not have access to local scope, but
@@ -776,9 +776,9 @@ Returns `true` if the given `sandbox` object has been [contextified][] using
776776
* `displayErrors` {boolean} When `true`, if an [`Error`][] error occurs
777777
while compiling the `code`, the line of code causing the error is attached
778778
to the stack trace.
779-
* `timeout` {number} Specifies the number of milliseconds to execute `code`
779+
* `timeout` {integer} Specifies the number of milliseconds to execute `code`
780780
before terminating execution. If execution is terminated, an [`Error`][]
781-
will be thrown.
781+
will be thrown. This value must be a strictly positive integer.
782782

783783
The `vm.runInContext()` method compiles `code`, runs it within the context of
784784
the `contextifiedSandbox`, then returns the result. Running code does not have
@@ -823,9 +823,9 @@ added: v0.3.1
823823
* `displayErrors` {boolean} When `true`, if an [`Error`][] error occurs
824824
while compiling the `code`, the line of code causing the error is attached
825825
to the stack trace.
826-
* `timeout` {number} Specifies the number of milliseconds to execute `code`
826+
* `timeout` {integer} Specifies the number of milliseconds to execute `code`
827827
before terminating execution. If execution is terminated, an [`Error`][]
828-
will be thrown.
828+
will be thrown. This value must be a strictly positive integer.
829829
* `contextName` {string} Human-readable name of the newly created context.
830830
**Default:** `'VM Context i'`, where `i` is an ascending numerical index of
831831
the created context.
@@ -877,9 +877,9 @@ added: v0.3.1
877877
* `displayErrors` {boolean} When `true`, if an [`Error`][] error occurs
878878
while compiling the `code`, the line of code causing the error is attached
879879
to the stack trace.
880-
* `timeout` {number} Specifies the number of milliseconds to execute `code`
880+
* `timeout` {integer} Specifies the number of milliseconds to execute `code`
881881
before terminating execution. If execution is terminated, an [`Error`][]
882-
will be thrown.
882+
will be thrown. This value must be a strictly positive integer.
883883

884884
`vm.runInThisContext()` compiles `code`, runs it within the context of the
885885
current `global` and returns the result. Running code does not have access to

0 commit comments

Comments
 (0)