Skip to content

Commit 9503365

Browse files
vdeturckheimMylesBorins
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 <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Trivikram Kamat <[email protected]>
1 parent 7f1e0e5 commit 9503365

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

doc/api/vm.md

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -237,9 +237,9 @@ in the ECMAScript specification.
237237
### module.evaluate([options])
238238

239239
* `options` {Object}
240-
* `timeout` {number} Specifies the number of milliseconds to evaluate
240+
* `timeout` {integer} Specifies the number of milliseconds to evaluate
241241
before terminating execution. If execution is interrupted, an [`Error`][]
242-
will be thrown.
242+
will be thrown. This value must be a strictly positive integer.
243243
* `breakOnSigint` {boolean} If `true`, the execution will be terminated when
244244
`SIGINT` (Ctrl+C) is received. Existing handlers for the event that have
245245
been attached via `process.on('SIGINT')` will be disabled during script
@@ -489,9 +489,9 @@ changes:
489489
* `displayErrors` {boolean} When `true`, if an [`Error`][] error occurs
490490
while compiling the `code`, the line of code causing the error is attached
491491
to the stack trace.
492-
* `timeout` {number} Specifies the number of milliseconds to execute `code`
492+
* `timeout` {integer} Specifies the number of milliseconds to execute `code`
493493
before terminating execution. If execution is terminated, an [`Error`][]
494-
will be thrown.
494+
will be thrown. This value must be a strictly positive integer.
495495
* `breakOnSigint`: if `true`, the execution will be terminated when
496496
`SIGINT` (Ctrl+C) is received. Existing handlers for the
497497
event that have been attached via `process.on('SIGINT')` will be disabled
@@ -552,9 +552,9 @@ changes:
552552
* `displayErrors` {boolean} When `true`, if an [`Error`][] error occurs
553553
while compiling the `code`, the line of code causing the error is attached
554554
to the stack trace.
555-
* `timeout` {number} Specifies the number of milliseconds to execute `code`
555+
* `timeout` {integer} Specifies the number of milliseconds to execute `code`
556556
before terminating execution. If execution is terminated, an [`Error`][]
557-
will be thrown.
557+
will be thrown. This value must be a strictly positive integer.
558558
* `contextName` {string} Human-readable name of the newly created context.
559559
**Default:** `'VM Context i'`, where `i` is an ascending numerical index of
560560
the created context.
@@ -610,9 +610,9 @@ added: v0.3.1
610610
* `displayErrors` {boolean} When `true`, if an [`Error`][] error occurs
611611
while compiling the `code`, the line of code causing the error is attached
612612
to the stack trace.
613-
* `timeout` {number} Specifies the number of milliseconds to execute `code`
613+
* `timeout` {integer} Specifies the number of milliseconds to execute `code`
614614
before terminating execution. If execution is terminated, an [`Error`][]
615-
will be thrown.
615+
will be thrown. This value must be a strictly positive integer.
616616

617617
Runs the compiled code contained by the `vm.Script` within the context of the
618618
current `global` object. Running code does not have access to local scope, but
@@ -757,9 +757,9 @@ Returns `true` if the given `sandbox` object has been [contextified][] using
757757
* `displayErrors` {boolean} When `true`, if an [`Error`][] error occurs
758758
while compiling the `code`, the line of code causing the error is attached
759759
to the stack trace.
760-
* `timeout` {number} Specifies the number of milliseconds to execute `code`
760+
* `timeout` {integer} Specifies the number of milliseconds to execute `code`
761761
before terminating execution. If execution is terminated, an [`Error`][]
762-
will be thrown.
762+
will be thrown. This value must be a strictly positive integer.
763763

764764
The `vm.runInContext()` method compiles `code`, runs it within the context of
765765
the `contextifiedSandbox`, then returns the result. Running code does not have
@@ -804,9 +804,9 @@ added: v0.3.1
804804
* `displayErrors` {boolean} When `true`, if an [`Error`][] error occurs
805805
while compiling the `code`, the line of code causing the error is attached
806806
to the stack trace.
807-
* `timeout` {number} Specifies the number of milliseconds to execute `code`
807+
* `timeout` {integer} Specifies the number of milliseconds to execute `code`
808808
before terminating execution. If execution is terminated, an [`Error`][]
809-
will be thrown.
809+
will be thrown. This value must be a strictly positive integer.
810810
* `contextName` {string} Human-readable name of the newly created context.
811811
**Default:** `'VM Context i'`, where `i` is an ascending numerical index of
812812
the created context.
@@ -858,9 +858,9 @@ added: v0.3.1
858858
* `displayErrors` {boolean} When `true`, if an [`Error`][] error occurs
859859
while compiling the `code`, the line of code causing the error is attached
860860
to the stack trace.
861-
* `timeout` {number} Specifies the number of milliseconds to execute `code`
861+
* `timeout` {integer} Specifies the number of milliseconds to execute `code`
862862
before terminating execution. If execution is terminated, an [`Error`][]
863-
will be thrown.
863+
will be thrown. This value must be a strictly positive integer.
864864

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

0 commit comments

Comments
 (0)