File tree Expand file tree Collapse file tree 3 files changed +22
-3
lines changed Expand file tree Collapse file tree 3 files changed +22
-3
lines changed Original file line number Diff line number Diff line change @@ -197,7 +197,8 @@ debug>
197197* ` watchers ` : List all watchers and their values (automatically listed on each
198198 breakpoint)
199199* ` repl ` : Open debugger's repl for evaluation in debugging script's context
200- * ` exec expr ` : Execute an expression in debugging script's context
200+ * ` exec expr ` , ` p expr ` : Execute an expression in debugging script's context and
201+ print its value
201202
202203### Execution control
203204
Original file line number Diff line number Diff line change @@ -68,6 +68,7 @@ const SHORTCUTS = {
6868 setBreakpoint : 'sb' ,
6969 clearBreakpoint : 'cb' ,
7070 run : 'r' ,
71+ exec : 'p'
7172} ;
7273
7374const HELP = StringPrototypeTrim ( `
@@ -93,7 +94,8 @@ watch(expr) Start watching the given expression
9394unwatch(expr) Stop watching an expression
9495watchers Print all watched expressions and their current values
9596
96- exec(expr) Evaluate the expression and print the value
97+ exec(expr), p(expr), exec expr, p expr
98+ Evaluate the expression and print the value
9799repl Enter a debug repl that works like exec
98100
99101scripts List application scripts that are currently loaded
@@ -530,7 +532,7 @@ function createRepl(inspector) {
530532 function prepareControlCode ( input ) {
531533 if ( input === '\n' ) return lastCommand ;
532534 // Add parentheses: exec process.title => exec("process.title");
533- const match = RegExpPrototypeSymbolMatch ( / ^ \s * e x e c \s + ( [ ^ \n ] * ) / , input ) ;
535+ const match = RegExpPrototypeSymbolMatch ( / ^ \s * (?: e x e c | p ) \s + ( [ ^ \n ] * ) / , input ) ;
534536 if ( match ) {
535537 lastCommand = `exec(${ JSONStringify ( match [ 1 ] ) } )` ;
536538 } else {
Original file line number Diff line number Diff line change @@ -27,6 +27,14 @@ const assert = require('assert');
2727 'works w/o paren'
2828 ) ;
2929 } )
30+ . then ( ( ) => cli . command ( 'p [typeof heartbeat, typeof process.exit]' ) )
31+ . then ( ( ) => {
32+ assert . match (
33+ cli . output ,
34+ / \[ ' f u n c t i o n ' , ' f u n c t i o n ' \] / ,
35+ 'works w/o paren, short'
36+ ) ;
37+ } )
3038 . then ( ( ) => cli . command ( 'repl' ) )
3139 . then ( ( ) => {
3240 assert . match (
@@ -54,6 +62,14 @@ const assert = require('assert');
5462 'works w/ paren'
5563 ) ;
5664 } )
65+ . then ( ( ) => cli . command ( 'p("[typeof heartbeat, typeof process.exit]")' ) )
66+ . then ( ( ) => {
67+ assert . match (
68+ cli . output ,
69+ / \[ ' f u n c t i o n ' , ' f u n c t i o n ' \] / ,
70+ 'works w/ paren, short'
71+ ) ;
72+ } )
5773 . then ( ( ) => cli . command ( 'cont' ) )
5874 . then ( ( ) => cli . command ( 'exec [typeof heartbeat, typeof process.exit]' ) )
5975 . then ( ( ) => {
You can’t perform that action at this time.
0 commit comments