File tree Expand file tree Collapse file tree 4 files changed +16
-7
lines changed
Expand file tree Collapse file tree 4 files changed +16
-7
lines changed Original file line number Diff line number Diff line change @@ -158,7 +158,7 @@ async function run(
158158 test : cli . input . length <= 1 ,
159159 message : 'Can only accept one DIR (make sure to escape spaces!)' ,
160160 pass : 'ok' ,
161- fail : ' received ' + cli . input . length ,
161+ fail : ` received ${ cli . input . length } ` ,
162162 } ,
163163 {
164164 nook : true ,
Original file line number Diff line number Diff line change 11import colors from 'yoctocolors-cjs'
22
33import { logger } from '@socketsecurity/registry/lib/logger'
4+ import { stripAnsi } from '@socketsecurity/registry/lib/strings'
45
56import { failMsgWithBadge } from './fail-msg-with-badge.mts'
67import { serializeResultJson } from './serialize-result-json.mts'
@@ -53,7 +54,7 @@ export function checkCommandInput(
5354 serializeResultJson ( {
5455 ok : false ,
5556 message : 'Input error' ,
56- data : msg . join ( '\n' ) ,
57+ data : stripAnsi ( msg . join ( '\n' ) ) ,
5758 } ) ,
5859 )
5960 } else {
Original file line number Diff line number Diff line change @@ -14,7 +14,7 @@ export function serializeResultJson(data: CResult<unknown>): string {
1414 debugFn ( 'inspect' , 'data:\n' , data )
1515 }
1616
17- // We should not allow the json value to be "null", or a boolean/number/string,
17+ // We should not allow the JSON value to be "null", or a boolean/number/string,
1818 // even if they are valid "json".
1919 const message =
2020 'There was a problem converting the data set to JSON. The JSON was not an object. Please try again without --json'
Original file line number Diff line number Diff line change @@ -64,15 +64,23 @@ export async function invokeNpm(
6464 return {
6565 status : true ,
6666 code : 0 ,
67- stdout : toAsciiSafeString ( normalizeLogSymbols ( stripAnsi ( output . stdout . trim ( ) ) ) ) ,
68- stderr : toAsciiSafeString ( normalizeLogSymbols ( stripAnsi ( output . stderr . trim ( ) ) ) ) ,
67+ stdout : toAsciiSafeString (
68+ normalizeLogSymbols ( stripAnsi ( output . stdout . trim ( ) ) ) ,
69+ ) ,
70+ stderr : toAsciiSafeString (
71+ normalizeLogSymbols ( stripAnsi ( output . stderr . trim ( ) ) ) ,
72+ ) ,
6973 }
7074 } catch ( e : unknown ) {
7175 return {
7276 status : false ,
7377 code : e ?. [ 'code' ] ,
74- stdout : toAsciiSafeString ( normalizeLogSymbols ( stripAnsi ( e ?. [ 'stdout' ] ?. trim ( ) ?? '' ) ) ) ,
75- stderr : toAsciiSafeString ( normalizeLogSymbols ( stripAnsi ( e ?. [ 'stderr' ] ?. trim ( ) ?? '' ) ) ) ,
78+ stdout : toAsciiSafeString (
79+ normalizeLogSymbols ( stripAnsi ( e ?. [ 'stdout' ] ?. trim ( ) ?? '' ) ) ,
80+ ) ,
81+ stderr : toAsciiSafeString (
82+ normalizeLogSymbols ( stripAnsi ( e ?. [ 'stderr' ] ?. trim ( ) ?? '' ) ) ,
83+ ) ,
7684 }
7785 }
7886}
You can’t perform that action at this time.
0 commit comments