Skip to content

Commit e018630

Browse files
committed
fix: add arguments back to the logged banner
1 parent 82ef491 commit e018630

File tree

2 files changed

+13
-5
lines changed

2 files changed

+13
-5
lines changed

lib/run-script-pkg.js

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,15 @@ const signalManager = require('./signal-manager.js')
66
const isServerPackage = require('./is-server-package.js')
77

88
// you wouldn't like me when I'm angry...
9-
const bruce = (id, event, cmd) =>
10-
`\n> ${id ? id + ' ' : ''}${event}\n> ${cmd.trim().replace(/\n/g, '\n> ')}\n`
9+
const bruce = (id, event, cmd, args) => {
10+
let banner = `\n> ${id ? id + ' ' : ''}${event}\n`
11+
banner += `> ${cmd.trim().replace(/\n/g, '\n> ')}`
12+
if (args.length) {
13+
banner += ` ${args.join(' ')}`
14+
}
15+
banner += '\n'
16+
return banner
17+
}
1118

1219
const runScriptPkg = async options => {
1320
const {
@@ -52,7 +59,7 @@ const runScriptPkg = async options => {
5259

5360
if (stdio === 'inherit' && banner !== false) {
5461
// we're dumping to the parent's stdout, so print the banner
55-
console.log(bruce(pkg._id, event, cmd))
62+
console.log(bruce(pkg._id, event, cmd, args))
5663
}
5764

5865
const [spawnShell, spawnArgs, spawnOpts] = makeSpawnArgs({

test/run-script-pkg.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,7 @@ t.test('do the banner with no pkgid', t => {
239239
},
240240
stdio: 'inherit',
241241
cmd: 'bar',
242+
args: ['baz', 'buzz'],
242243
pkg: {
243244
scripts: {},
244245
},
@@ -247,19 +248,19 @@ t.test('do the banner with no pkgid', t => {
247248
event: 'foo',
248249
path: 'path',
249250
scriptShell: 'sh',
250-
args: [],
251251
binPaths: false,
252252
env: {
253253
environ: 'value',
254254
},
255255
stdio: 'inherit',
256256
cmd: 'bar',
257+
args: ['baz', 'buzz'],
257258
}, {
258259
event: 'foo',
259260
script: 'bar',
260261
path: 'path',
261262
pkgid: undefined,
262-
}])).then(() => t.strictSame(logs, [['\n> foo\n> bar\n']]))
263+
}])).then(() => t.strictSame(logs, [['\n> foo\n> bar baz buzz\n']]))
263264
})
264265

265266
t.test('pkg has foo script', t => runScriptPkg({

0 commit comments

Comments
 (0)